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. It is raining. What does the program say?

      • Both messages
      • Nothing
      • Wear a hat
      • Take an umbrella
      Show answer

      Answer: Take an umbrella. The condition is true, so the first branch runs.

    2. 2. What does this program say?

      • 10
      • 6
      • 4
      • 46
      Show answer

      Answer: 6. Setting x again replaces the old value, so x is 6.

    3. 3. 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.

    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.