
In computer programming, a loop is used when instructions are repeated a certain number of times until a certain condition has been reached, making the condition true. (Two possible values are either true or false: this is known as a boolean variable. The value of 1 represents true and the value of 0 represents false.)
In Scratch, there are 3 types of loops:
- while (while something is true, the program continues to run)
- Sleep when you are tired
- for (program repeats for a specific number of times)
- Add 3 teaspoons of honey to your cup of tea
- infinite (program runs until it ends or is forced to stop)
- While your car’s tank has gas, you drive your car
Why bother with loops? DRY (Don’t Repeat Yourself) Think: less is more! You’ll reduce the amount of code by using loops.


When you run this program, the sprite (cat) uses less code than the costume (bowtie), but they have the same outcome.