Pip
Lesson 7 of 12

What is coding?

4–6 min+100 XP
Grace and Pip in lesson 7: What is coding?

Your mission

Bolt the robot is stuck in a game level. Grace uses loops, if statements and a variable called score to get him to the door. Your turn to write the code.

Power-ups

  • LoopsRepeat a step instead of writing it again. A loop must know when to stop.
  • If statementsMake a choice: if the trap is on, wait.
  • VariablesA labelled box that remembers a value. score = 2 + 1 = 3.

Your turnTry it yourself

Quick checkThree questions

1A loop that never stops is…

Always tell a loop when to stop.

2"If trap is on, wait" is a…

It checks before acting.

3score is 2. Bolt gets a coin. score = ?

2 + 1 = 3.

Off-screen challenge: Human robot

Write a loop for a friend: "repeat 4 times: step, clap". Add an if: "if you see red, jump".

Last time: algorithms. Next time: what's inside a computer?