The Boolean type represents the two logical values, True and False.
Dim name As Boolean | Bool
Dim Name?
Type declaration character is ?. Range: -1 - 0.
False = 0
True = -1
Boolean values are stored in a Byte.
With an array of Bool the values are stored in a bit.
When other numeric types are converted to Boolean values, 0 becomes False and all other values become True. When Boolean values are converted to other data types, False becomes 0, and True becomes -1.
Dim d As Boolean = -1
Local Bool d1 = True
Global d2?
Dim f?(7) // occupies 1 Byte
Dim f2?(10) // occupies 2 bytes
Type BoolTrouble
a0 As Bool
a1 As Bool
a2 As Bool
a3 As Bool
a4 As Bool
a5 As Bool
a6 As Bool
a7 As Bool' <- 8th bool in a row
EndType
Dim bl As BoolTrouble
Message bl.a0
bl.a0 = True
Message bl.a0
bl.a7 = False ' and V:bl.a0, 8
Message bl.a0
You have a few options. You could use the eighth bit as a dummy and don't use it. Or, you can explicitly set and clear the bit:
Bset bl.a7, 1' bl.a7 = True
Bclr bl.a7, 1' bl.a7 = False
Local alignadj? = ((wb.align And 3) = 3)
If alignadj? Then Sub wb.align, 3 // If true, this line is ignored
If alignadj? Then Add wb.align, 2 // This line is actioned
The workaround is to change line one to:
Local alignadj? : If ((wb.Align And 3) = 3) Then alignadj? = True
[Reported by James Gaite, 27/05/2020]
Boolean, Byte, Card, Short, Word, Int16, Long, Int, Integer, Int32, Int64, Large, Single, Double, Currency, Date, Handle, String, Variant, Object
{Created by Sjouke Hamstra; Last updated: 29/06/2020 by James Gaite}