The boolean’s variable can take the values 0 (false) or 1 (true).
Each boolean variable use 1 Byte of memory :
Here is how we initialize a boolean:
The boolean can be use in if, for or while loop to express the condition we want to test.
We will see some examples:
We will see now the different expressions that we can do with booleans.
a) Boolean expression OR
The boolean expression OR is used to verify if at least one of the both variables is at the state you wanted.
b) Boolean expression AND
The boolean expression AND can verify if the both variables are high state:
You can find others boolean expressions on our course on mathematics function.
We will see how to reverse the value (state) of the boolean with an exclamation point: