BOOLEAN
Source: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgBoolean Last revised: 2022-02-23
Standard data type: boolean (True/False).
Syntax
Dim variable As BooleanDescription
Boolean data type. Can hold the values True or False. Default value on initialization is False.
Notes:
- The boolean data type is a 1-bit integer, having the value 0 to indicate
Falseand 1 to indicateTrue. - The hardware does not directly support a 1-bit data type; the smallest register or memory size we can work with is 8-bits or 1-byte.
- When assigning a boolean with an integer value (by implicit conversion):
0induces theFalsestate and1or-1induces theTruestate (any other value also induces theTruestate, but with a warning message). - When assigning a numeric type with a boolean:
Falseinduces the0value andTrueinduces the-1value.
Examples
vb
Dim boolvar As Boolean
boolvar = True
Print "boolvar = ", boolvarOutput:
boolvar = trueVersion
- Since fbc 1.04.0
Dialect Differences
- Not available in the
-lang qbdialect unless referenced with the alias__Boolean.
Differences from QB
- New to FreeBASIC.