0

If blocks

  1. the question
    what you do

    You use if every day

    If it rains, you take an umbrella. If it is sunny, you leave it home. You check first, then you act.

  2. move right
    if on a star
    collect the star
    move right

    The if block

    The robot moves, then asks: am I on a star? Yes! So it does the block inside the if. It collects the star.

  3. repeat 4 times
    move right
    if on a star
    collect the star

    If the answer is no

    When the answer is no, the robot skips the blocks inside. Watch the robot walk past the empty squares.

  4. repeat 4 times
    move right
    if on a star
    collect the star

    One program, many boards

    Here is the same program on a new board. The stars moved, but it still works. The if block checks every square.

For parents

Goal: Your child learns that an if block asks a yes or no question, and the robot only does the blocks inside when the answer is yes.

  • Use the words if and then in daily talk: if your hands are dirty, then wash them.
  • When the robot runs, ask at each square: is the answer yes or no here?
  • Point out that the same program works on a new board because the if block checks for itself.

Away from the screen: Play a clapping game. Say: if I hold up a red thing, clap. Hold up different things. Your child claps only when the answer is yes. Then let your child make the rule.

Coding · Making Choices
Back to top