0

Blocks become code

  1. move up
    move right
    move right
    move down

    The robot reads words

    You know the move blocks. Now the robot learns to read words. Each block has a code name. Right is move_right(). Up is move_up(). Left is move_left(). Down is move_down().

  2. move_down()
    move_down()
    move_right()

    One line, one step

    The robot wants to reach the star. Write one line for each step. The robot reads from the top line down. This code says down, down, right.

  3. move down
    move down
    move right

    Watch the robot

    Here is that code as blocks on a board. Tap Run the program. It goes down 2 squares. Then it goes right 1 square. It lands on the star.

  4. move_right()
    The robot knows this
    move right
    The robot is stuck

    Spell it just right

    The robot is very fussy about spelling. Put a low line between the two words. End with two round brackets. The robot does not know move right.

  5. move_up()
    move_up()
    move_left()

    Your turn

    The blocks are up, up, left. Say the code out loud, one line at a time. Then check your lines with this box.

For parents

Goal: Your child learns that each arrow block can be written as one line of real code.

  • Point to each line and ask: which way does the robot go?
  • Spell move_right() together, with the low line and the two brackets.
  • In the labs your child reads code, sorts lines the robot can read, and builds a program. Tap See it as code to show the blocks as real lines.

Away from the screen: Write move_up(), move_down(), move_left() and move_right() on four cards. Hold one up, and your child takes one step that way.

Coding · From Blocks to Code
Back to top