Skip to content
Exit presentation

Intro Programming with Blocks

If there is a wall ahead

A sprite walks into a wall and stops. Can it check first?

An if wall ahead block checks the way ahead.
Step 1 of 4
  1. An if wall ahead block checks the way ahead.
  2. Wall found — the blocks inside run.
  3. Path clear — the blocks inside are skipped.
  4. The check happens each time the block runs.

Yes. An if block lets the sprite check first.

An if block runs its blocks only when the check is true.

If wall ahead looks at the square in front. A wall or the grid edge makes the check true. Then the blocks inside the if block run. If the way is clear, the blocks inside are skipped.

In the lab, the program is: Move forward. If wall ahead, Turn left. Move forward.

Switch the wall on and off. Watch the if block.

Loading lab…

Jump to lesson

This track

  1. 0 Start here
  2. 1 Blocks you snap together
  3. 2 Order changes everything
  4. 3 One block instead of four
  5. 4 If there is a wall ahead
  6. 5 Finding the one wrong block
  7. 6 The big picture
  8. 7 Track quiz

Other tracks