Data types: bool

Represents a boolean value.

Type syntax

bool

Literal syntax

true

false

Discussion

Operands with this data type are intended to store either the value true or false. The literals can be used within expressions wherever a bool operand is expected. The type name bool, in turn, is designated to be used in declarations of data members. For example:

var bool initialized = false;

Logical operations

You can combine a bool operand with other operands to logical expressions. The following table provides an overview of the possible operations:

Operator

Short description

!

Logical NOT

&&

Logical AND

||

Logical OR

Comparison operations

You can compare two bool operands in order to test whether these are equal or not. The following table provides an overview of the possible operations:

Operator

Short description

==

Equality test for two bool operands.

!=

Inequality test for two bool operands.