Loops Block-Examples
1.Repeat:
Blinking heart
Flash the heart icon on the screen 4 times.
2.While:
Repeat code while a Boolean condition is true.
Example: diagonal line
The following example uses a while loop to make a diagonal line on the LED screen (points 0 0 , 1 1, 2 2, 3 3)
3.For:
Example: Count to 4
This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen.
4.For Of:
Example: Find the highest number
Find the highest number in a list of numbers. Display the highest number on the screen.
5.every Interval:
Example
At every 200 milliseconds of time, check if either the A or B button is pressed. If so, show on the screen which one is pressed.
6.Break:
7.Continue: