0

Read a program

  1. move right
    move down
    move right

    Read like the robot

    Now the robot hands you its code. Where will it go? Read it the way the robot does. Start at the top line. Do one line at a time. Never skip a line.

  2. move_up()
    move_right()
    move_right()

    Point to each line

    Put your finger on line 1. It says up, so the robot goes up 1. Lines 2 and 3 both say right. So the robot goes right 2.

  3. move up
    move right
    move right

    Watch the robot

    Here is the same code as blocks. Tap Run the program. Up 1, then right 2. The robot ends on the star.

  4. move_right()
    move_right()
    move_left()

    Moves that undo

    Some moves undo each other. Right, then left, puts the robot back. This code goes right 2, then left 1. The robot ends just 1 square right.

  5. move up
    move up
    move right
    move right

    Short and long programs

    Two programs can reach the same star. A long one might go right, then back left. Those moves undo each other. Take them out. This short program has no extra steps.

For parents

Goal: Your child learns to read code one line at a time, from top to bottom, and tell where the robot ends up.

  • Ask your child to put a finger on each line and say the move out loud.
  • Ask: where does the robot end up? Then check on the board together.
  • In the labs your child guesses where code takes the robot, puts reading steps in order, and writes a short program. Fewer lines earn more stars.

Away from the screen: Write a short program on paper, like up, up, right. Your child reads it line by line and walks it out on floor tiles.

Coding · From Blocks to Code
Back to top