☆ for loops
a loop, also called iteration or repetition, is a way to repeat one or more statements
a for loop executes the code inside for a specified amount of times
FOR variable name FROM start number TO end number
END FOR
pseudocode example: displays every even number from 1 to n
RECEIVE N FROM (REAL) KEYBOARD
FOR count FROM 2 TO N STEP 2 DO
SEND count TO DISPLAY
END FOR
☆ while loops
a while loop checks if the condition is true, and runs the code continously until it is not
WHILE <condition> DO
<statements>
END WHILE
pseudocode example:
SET i TO 0
WHILE i < 5 DO
SEND i TO DISPLAY
SET i TO i + 1
END WHILE
this displays:
0
1
2
3
4
☆ repeat… until loop