Boolean

Boolean
A bool variable can be either true(1) or false(0). They're used in 'if' statements, loops, and much more. They can be compared with basic boolean algebra:

AND(&, &&)

 * || T || F ||
 * T || 1 || 0 ||
 * F || 0 || 0 ||

OR(|, ||)

 * || T || F ||
 * T || 1 || 1 ||
 * F || 1 || 0 ||

Equal(
)===
 * || T || F ||
 * T || 1 || 0 ||
 * F || 0 || 1 ||

Not Equal(!=)

 * || T || F ||
 * T || 0 || 1 ||
 * F || 1 || 0 ||

bit-wise Exclusive OR(^)

 * || T || F ||
 * T || 0 || 1 ||
 * F || 1 || 0 ||

In Java
In java the bool value is initialized with the data type: 'boolean'.

code format="java" public class Main{ public static void main(String[] args){ boolean var = true; //a bool } } code

In C++
In C++ the bool value is initialized with the data type: 'bool'.

code format="cpp" int main{ bool var = true; //a bool return 0; } code