Computer Science Grade 3 20 min

Making Decisions in Code

Making Decisions in Code

Tutorial Preview

1

Introduction & Learning Objectives

Learning Objectives Define the term 'conditional' as a choice in a program. Identify the 'if' (condition) and 'then' (action) parts of a simple conditional statement. Explain what happens in an 'if-then' statement when the condition is true. Explain what happens in an 'if-then' statement when the condition is false (nothing happens). Predict the outcome of a short program that uses one 'if-then' conditional. Create a simple 'if-then' conditional using block-based code. Provide a real-life example of an 'if-then' decision. What if it's raining when you want to play outside? 🌧️ What choice do you make? Just like we make choices every day, we can teach computers to make choices too! We will...
2

Key Concepts & Vocabulary

TermDefinitionExample ConditionalA special instruction that lets a computer make a choice. It's like asking a 'what if' question.Asking a robot 'IF the light is red, THEN stop moving.' If-Then StatementA type of conditional. It tells the computer: 'IF something is true, THEN do this action.''IF the cat is hungry, THEN feed the cat.' ConditionThe 'if' part of the statement. It's a question that can be answered with 'yes' (true) or 'no' (false).In 'IF it is raining...', the condition is 'it is raining'. ActionThe 'then' part of the statement. It's the instruction the computer follows only if the condition is true.In '...THEN get an umbrella', the action is 'get a...
3

Core Syntax & Patterns

The 'If-Then' Pattern IF [condition], THEN [action] Use this when you want something to happen ONLY when the condition is true. If the condition is false, the computer just skips the action and moves on. The 'If-Then-Else' Pattern IF [condition], THEN [action 1], ELSE [action 2] Use this when you want to make a choice between two different actions. If the condition is true, do action 1. If the condition is false, do action 2.

4 more steps in this tutorial

Sign up free to access the complete tutorial with worked examples and practice.

Sign Up Free to Continue

Sample Practice Questions

Challenging
You are designing a virtual pet. It should wag its tail if it's happy, and it becomes happy if you feed it. Which set of conditional rules makes the most sense to code this?
A.IF pet wags tail, THEN pet becomes happy.
B.IF you feed pet, THEN pet becomes happy. IF pet is happy, THEN wag tail.
C.IF you feed pet, THEN wag tail.
D.IF pet is happy, THEN you feed it.
Challenging
A self-driving car needs to stop if a person is in front OR if the traffic light is red. Which single rule would work best for this?
A.IF light is red, THEN stop.
B.IF person is in front, THEN stop.
C.IF light is red OR person is in front, THEN stop.
D.IF light is green, THEN go.
Challenging
To get a secret item, a player must be in the cave. Inside the cave, they must also have a lantern. The code is structured like this: "IF player is in cave, THEN { IF player has lantern, THEN get item }". What is this an example of?
A.broken conditional that will never work.
B.repeating loop that goes on forever.
C.nested conditional.
D.An ELSE statement.

Want to practice and check your answers?

Sign up to access all questions with instant feedback, explanations, and progress tracking.

Start Practicing Free

Ready to find your learning gaps?

Take a free diagnostic test and get a personalized learning plan in minutes.