Keyword for storing the Boolean values true
and false
. bool is an alias of System.Boolean.
The default value of a bool is false.
bool b; // default value is false
b = true; // true
b = ((5 + 2) == 6); // false
For a bool to allow null values it must be initialized as a bool?.
The default value of a bool? is null.
bool? a // default value is null