by David J. Malan <malan@post.harvard.edu>
Printer-Friendly Version of Tutorial

« Previous | Table of Contents | Next »

Loops

In programming, a loop can induce multiple executions of statements. In Scratch, any block whose label begins with "forever" or "repeat" is a looping construct.

One such block is:



This construct allows us, for instance, to instruct a sprite to meow every other second:



Another block allows you to loop a specific number of times:



And another block allows you to loop until some condition is true:



Sometimes, you want execute some statement multiple times, each time varying your behavior ever so slightly. We thus turn our attention to variables.

« Previous | Table of Contents | Next »