Skip to content

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 Boolean

Description

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 False and 1 to indicate True.
  • 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): 0 induces the False state and 1 or -1 induces the True state (any other value also induces the True state, but with a warning message).
  • When assigning a numeric type with a boolean: False induces the 0 value and True induces the -1 value.

Examples

vb
Dim boolvar As Boolean
boolvar = True
Print "boolvar = ", boolvar

Output:

boolvar =     true

Version

  • Since fbc 1.04.0

Dialect Differences

  • Not available in the -lang qb dialect unless referenced with the alias __Boolean.

Differences from QB

  • New to FreeBASIC.

See Also

Translated from FreeBASIC official docs. Contact us for removal if infringed.
FreeBASIC is an open-source project, not affiliated with Microsoft