Computer Science
Grade 1
20 min
If-Then Statements with Shapes
Practice using 'if-then' statements with shapes (e.g., If it is a square, then it has four sides).
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Identify the 'if' part (condition) of a rule.
Identify the 'then' part (action) of a rule.
Explain what an If-Then statement is using simple words.
Apply a simple If-Then rule to a single shape.
Follow a sequence of If-Then rules for a group of shapes.
Create their own simple If-Then rule using shapes and colors.
What if you could only eat a cookie IF it was a circle shape? πͺ Let's learn about IF rules!
We will learn about special computer rules called If-Then. These rules help computers make smart choices. It's like a fun game of following directions!
Real-World Applications
IF it is raining, THEN I will bring an umbrella. β
IF the light is green, THEN we can cross the street. π¦
IF I am hungry, THEN I will eat a...
2
Key Concepts & Vocabulary
TermDefinitionExample
If-Then StatementA special rule that tells a computer what to do. It has two parts: an 'If' and a 'Then'.IF the shape is a square π¦, THEN raise your hand. π
Condition (The 'If' part)The first part of the rule. It is the thing we check to see if it's true. β
In the rule 'IF the shape is red...', the condition is 'the shape is red'.
Action (The 'Then' part)The second part of the rule. It is the thing we DO if the condition is true. πIn the rule '...THEN clap your hands', the action is 'clap your hands'.
RuleAn instruction that tells you exactly what to do. Computers need rules to work.A rule could be: 'Always put your toys away after playing.' π§Έ
ShapeThe form of an object...
3
Core Syntax & Patterns
The If-Then Pattern
IF [a condition is true], THEN [do an action].
This is the main pattern for our computer thinking. First, check the IF part. If it's true, do the THEN part.
The 'Do Nothing' Rule
IF [a condition is false], THEN [do nothing].
If the IF part is not true, you just move on. You don't do the action.
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
The rule is: IF a shape is a square, THEN look at its color. IF its color is green, THEN shout 'Go!'. You see a green square π©. What do you do?
A.Look at its color
B.Shout 'Go!'
C.Do nothing
D.Say 'square'
Challenging
You want ONLY the yellow stars (πβ) to be put in a box. What is the best rule to tell a computer?
A.IF it is a star, THEN put it in the box.
B.IF it is yellow, THEN put it in the box.
C.IF it is a yellow star, THEN put it in the box.
D.IF it is not a circle, THEN put it in the box.
Challenging
A robot's rules are: IF you see a circle π΅, THEN move forward. IF you see a square π₯, THEN turn left. The robot sees this sequence: π΅, π₯, π΅. What does the robot do?
A.Forward, Left, Forward
B.Left, Forward, Left
C.Forward, Forward, Left
D.Left, Left, Forward
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free