Boolean (data type)

Syntax

Boolean

Description

A data type capable of representing the logical values TRUE and FALSE.

Comments

Boolean variables are used to hold a binary value—either TRUE or FALSE. Variables can be declared as Boolean using the Dim, Public, or Private statement.

Variants can hold Boolean values when assigned the results of comparisons or the constants TRUE or FALSE.

Internally, a Boolean variable is a 2-byte value holding –1 (for TRUE) or 0 (for FALSE).

Any type of data can be assigned to Boolean variables. When assigning, non-0 values are converted to TRUE, and 0 values are converted to FALSE.

When appearing as a structure member, Boolean members require 2 bytes of storage.

When used within binary or random files, 2 bytes of storage are required.

When passed to external routines, Boolean values are sign-extended to the size of an integer on that platform (either 16 or 32 bits) before pushing onto the stack.

There is no type-declaration character for Boolean variables.

 

Boolean variables that have not yet been assigned are given an initial value of False.

See Also

Currency (data type); Date (data type); Double (data type); Integer (data type); Long (data type); Object (data type); Single (data type); String (data type); Variant (data type); DefType (statement); CBool (function); True (constant); False (constant).

More information

B