Menu

Loops let you run the same code multiple times. In bubblecode, loops start with repeat and end with end repeat.

Counting loops

The most common loop counts from one number to another:

count.bubble

Counting down

Add down to count in reverse:

countdown.bubble

Repeat a fixed number of times

If you don’t need a counter, just specify how many times:

fixed.bubble

repeat until

Keep looping until a condition becomes true:

until.bubble

Loops + conditions

Combine loops with if to do interesting things:

fizz.bubble

Exercise

Exercise

Print the numbers 1 through 5, each on its own line.

exercise.bubble

Quiz

Question 1 of 3

What keyword ends a loop in bubblecode?