← Years 5–6 Creating Digital Solutions

Combining conditions with and, or, not

Blocks that combine or flip true/false conditions. And needs both to be true, or needs at least one to be true, and not reverses true to false and false to true.

Understanding Combining conditions with and, or, not in Years 5–6 Creating Digital Solutions

What it does: Not flips true to false and false to true, so this is true whenever the sprite is away from the edge. The and block makes the if block run only when both the answer is correct and the timer is above zero. The 'and' block needs BOTH conditions to be true. The space key is not pressed, so the whole block is false. You need both things to be true, so use 'and'. Using 'or' would let the player pass with only one. 10 is not less than 8 and 10 is not greater than 12. Neither side is true, so 'or' reports false.

Common mistakes: The sprite says it has both items, so the if block needs 'and'. 'or' would be true with only one item. It should be: if <key> and <map> then. The second if block should say to leave the umbrella when it is NOT raining. Without 'not' it runs when it is raining, so both messages play in the rain. It should be: if <not <raining>> then.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 51–60) and word search (Modules 41–74).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
The block <score > 5 and key space pressed?> is true when the score is 8 but the space key is NOT pressed. True or false?
TrueFalse
Matches
if <<age > 8> or <age < 12>> then (meant: age must be between 8 and 12)
↓
The or block was used when both conditions must be true. Any age would pass, because every number is over 8 or under 12. It should use and.
Applying
Meanings
Term
and, or, not
Meaning
Blocks that combine or flip true/false conditions. And needs both to be true, or needs at least one to be true, and not reverses true to false and false to true.
Practice
IF score > 5 and lives > 0 THEN
Testing
Gaps
if <<score > 5> <lives > 0>> then
Check Answer
Spots
1when green flag clicked
2if <key> or <map> then

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Desert Jerboa' badge — High Jumper, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. The block <score > 5 and key space pressed?> is true when the score is 8 but the space key is NOT pressed. True or false?
A. False ✓
B. True
The 'and' block needs BOTH conditions to be true. The space key is not pressed, so the whole block is false.
2. Which block is true when only ONE of the two conditions is true?
A. or ✓
B. and
The 'or' block needs at least one condition to be true. The 'and' block needs both.
3. The sprite is not touching the edge. What does <not <touching edge?>> report?
A. False
B. True ✓
The 'not' block flips the answer. Touching edge is false, so not flips it to true.
4. Which block would you use to check that a player has a key AND has 3 lives left?
A. <have key?> or <lives = 3>
B. <have key?> and <lives = 3> ✓
You need both things to be true, so use 'and'. Using 'or' would let the player pass with only one.
5. The block <age < 8 or age > 12> is checked when age is 10. What does it report?
A. False ✓
B. True
10 is not less than 8 and 10 is not greater than 12. Neither side is true, so 'or' reports false.

Match the Pairs

<score > 10> and <lives > 0> → True only when the score is over 10 AND there is at least one life left. Both parts must be true.
<key space pressed?> or <key up arrow pressed?> → True when either the space key or the up arrow key is pressed. Only one needs to be true.
The not block reverses a condition. If the sprite is NOT touching the edge, the block is true. → not <touching [edge]?>
Use and when two things must both be true, like the answer being right and the player having time left. → if <<answer = 5> and <timer > 0>> then
if <<age > 8> or <age < 12>> then (meant: age must be between 8 and 12) → The or block was used when both conditions must be true. Any age would pass, because every number is over 8 or under 12. It should use and.
if <touching [wall]?> then (meant: do this when NOT touching the wall) → The not block is missing, so the script runs when the sprite IS touching the wall. It should be: if <not <touching [wall]?>> then.

Key Term

and, or, not
Blocks that combine or flip true/false conditions. And needs both to be true, or needs at least one to be true, and not reverses true to false and false to true.

Fill in the Blanks

1. if <<score > 5> and <lives > 0>> then
Hint: Type the block that needs both conditions to be true.
2. if <<touching Cat?> or <touching Dog?>> then
Hint: Type the block that works when at least one condition is true.
3. if <not <touching edge?>> then
Hint: Type the block that reverses true to false and false to true.
4. <true> and <false> is false
Hint: Type the result when only one of the two sides is true and both are needed.
5. if <not <key space pressed?>> then say [Press space!] for (2) seconds
Hint: Type the block that flips the key check, so the script runs when the key is NOT down.

Spot the Error

Question 1
A when green flag clicked
B if <key> or <map> then
C say [You have both items!]
D end
Line B — The sprite says it has both items, so the if block needs 'and'. 'or' would be true with only one item. It should be: if <key> and <map> then.
Question 2
A set raining to true
B if <raining> then
C say [Take an umbrella!]
D if <raining> then
E say [Leave the umbrella!]
Line D — The second if block should say to leave the umbrella when it is NOT raining. Without 'not' it runs when it is raining, so both messages play in the rain. It should be: if <not <raining>> then.
Question 3
A set age to 11
B say [Checking age...]
C if <age > 9> or <age < 13>
D say [You can join the club]
Line C — The club is only for ages 10 to 12, so both tests must be true. 'or' lets in every age, such as 5 or 50. It should use 'and'.
Question 4
A set ticket to false
B set pass to true
C if <ticket> and <pass> then
D say [You can come in!]
Line C — Someone can come in with a ticket or a pass, so only one needs to be true. 'and' would need both and would turn this person away. It should be: if <ticket> or <pass> then.
Question 5
A set score to 0
B if <not <score > 0>> then
C say [You scored!]
D end
Line B — 'not <score > 0>' is true when the score is 0 or less, which is the opposite of 'You scored!'. To say it when the score is not 0, it should be: if <not <score = 0>> then.

Student with a class code? Join your class →