Oxygen Basic
Programming => Problems & Solutions => Topic started by: Arnold on November 27, 2018, 01:14:17 AM
Title:
Question about bool and boolean
Post by:
Arnold
on
November 27, 2018, 01:14:17 AM
Hi Charles,
in the past you changed the value of true to -1 sometime. This makes sense to me:
Code: OxygenBasic
uses console
printl "true = "true
printl "
not
true = "
not
true
printl "
not
false "
not
false
printl
printl "
not
1 = "
not
1
printl "Enter ..." : waitkey
Some languages define true as a value of 1. Will it be safe if I use: % true=1 in the beginning of my code?
I noticed that there are the types bool and boolean. I assume there is no difference between these two types?
Roland
Title:
Re: Question about bool and boolean
Post by:
Charles Pegge
on
November 27, 2018, 04:57:14 AM
Hi Roland,
Glad you raised this subject. In the new o2, true will have a value of 1 by default. Comparators (A>B) will also return 1 when true.
I'm using the MS interpretation of Bool and Boolean:
Bool is 32bit (generally preferred)
Boolean is 8bit
Currently, they are pseudo-types. To be truly boolean they should be masked to 1bit.