BBC Bitesize Programming resources focusing on Boolean statements and loops
History of Computing- Rules of Logic includes real world ways of discussing and contextualisng Boolean logic
Boolean logic
Understand simple Boolean logic [for example, AND, OR and NOT] and some of its uses in circuits and programming
Boolean statements can have one of two values:
TRUE or FALSE. Saying that “6 is greater than 10” is a FALSE statement. Saying that “4 + 4 is equal? to 8” is TRUE. Pupils should be aware that they use Boolean logic in their everyday lives. For example, the statement “It is raining outside” is either TRUE or FALSE, depending on the weather.
AND, OR and NOT are given as examples of Boolean operations. I might say:
“4 is an odd number” AND “5 is an odd number”.
The first part of the statement is FALSE, so the overall statement is FALSE. But if I were to change the operator to an OR:
“4 is an odd number” OR “5 is an odd? number”,
the overall statement is now TRUE, as we only require one part to be TRUE.
If I add a NOT operator, the truth value will be reversed, so the following is FALSE:
“NOT (5 is an odd number)”.
.
These operations can be defined using truth tables. Pupils might be asked to come up with their own logical statements and test if they are TRUE or FALSE. You can also combine multiple statements using AND, OR and NOT operations.
Why are these concepts important for pupils to understand? Boolean logic is the means by which computers perform all of their calculations, as computer chips are built out of electronic circuits made up of logic ‘gates’. These gates are small pieces of electronics where the output voltage depends on whether the voltage is on or off at the inputs. Their operation can be demonstrated through software simulations or on paper.
Truth values and Boolean logic are fundamental to how computer programs work. When pupils use IF or WHILE statements they will always use truth values, and often need Boolean logic. For example:
IF Health < 50 AND Character is touching enemy THEN Game Over.
It is useful to encourage pupils to plan their programs and break down the logic involved using pseudocode or flowcharts.