Dart Booleans
Booleans
Dart has a data type named ‘bool’ to represent Boolean values : true and false, which are compile-time constants. ‘True’ or ‘False’ cannot be assigned with values 1 or 0.
Example,
bool m = true;
Program:
Consider the following code in Dart to understand the above point more clearly,
void main( )
{
// declaring Boolean variables
bool check1, check2;
check1 = 5 == 6;
check2 = 7 > 4;
// boolean has two values true and false
// based on above operations, true or false will be printed
print( check1 );
print( check2 );
}
Output
false
true