Information about cookies on this page

Our website uses cookies to ensure the functionality of the website, to collect and analyze information about the performance and usage of the website. Privacy Policy

  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in
  
  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in

Stairs

You can put more than one block in a loop. On every pass, all of them are carried out, from top to bottom, and only then does the next pass start. The loop

  • Repeat 2 times
    • Move forward
    • Turn right ↻

therefore does: forward, right, forward, right. Not forward, forward, right, right.

Remember the stairs from the Repeating Moves exercise. The four moves that repeated there are exactly what belongs in a loop. Now the stairs are higher: five stairs would take twenty blocks without a loop, but five blocks are enough with one.

On the last stair, the dog turns left even though it doesn't need to. That's fine: it's at the goal, just facing another way. A loop does every pass the same way, and that's all right as long as the result is what the task asks for.

Instructions

  1. 1

    Climb the stairs to the goal.

  2. 2

    Use at most 5 blocks.

Back

3/11

  1. 1. Repeating Moves
  2. 2. Loops
  3. 3. Stairs
  4. 4. After the Loop
  5. 5. Quiz: Pass by Pass
  6. 6. A Bone on Every Tile
  7. 7. Around the Flower Bed
  8. 8. A Loop in a Loop
  9. 9. A Bug in a Loop
  10. 10. Quiz: A Bug in a Nested Loop
  11. 11. Summary
Next

Try it yourself

Do this exercise right here in your browser. No account needed.