Skip to content

    Code Cove

    Year 4 Reading Code

    Read short programs with variables, loops and if–else, follow them line by line and predict exactly what they will do.

    • Ages 8–10
    • 3 quests
    • Beginner → Getting stronger → Challenge

    Before you can write good code, you have to be able to read it. At Code Cove, Year 4 coders become the computer: they follow short programs one line at a time and predict exactly what will happen.

    What your child will learn

    • Follow a program from top to bottom, one line at a time
    • Keep track of a variable as it is set and changed
    • Work out how many times the lines inside a loop run
    • Decide which branch of an if–else runs

    Be the computer

    A computer never guesses and never skips ahead. To trace a program, do the same: point at each line, do what it says, and write down the value of every variable as it changes.

    Indents matter

    Lines tucked in under “repeat” or “if” belong to it. A line that is not tucked in comes after the loop has finished, so it runs only once. Spotting where a loop ends is one of the most useful reading skills.

    Example questions

    Here are a few questions like the ones in the first quest. Can you solve them?

    1. 1. In what order does a computer run the lines of a program?

      • In a random order
      • All at once
      • From top to bottom, one at a time
      • From bottom to top
      Show answer

      Answer: From top to bottom, one at a time. A program runs line by line from the top, unless a loop or an “if” changes the path.

    2. 2. What is said last?

      • Ready
      • Nothing
      • Steady
      • Go
      Show answer

      Answer: Go. Lines run from top to bottom, so “Go” comes last.

    3. 3. What is lives at the end?

      • 1
      • 2
      • 4
      • 3
      Show answer

      Answer: 2. Lives starts at 3 and goes down by 1: 3 − 1 = 2.

    4. 4. Match each line of code to what it does.

      • repeat 3
      • x = 2 + 3
      • print("hi")
      • shows hi
      • x becomes 5
      • does it three times
      Show answer

      Answer: print("hi") → shows hi · repeat 3 → does it three times · x = 2 + 3 → x becomes 5. Reading code carefully tells you what it will do.

    Tips for grown-ups

    • Trace on paper: one column for each variable, one row for each line that runs.
    • Cover the answers and say your prediction aloud before looking.
    • Try the same programs in Scratch and see whether your prediction was right.