Loops
Last updated
Last updated
Loops provides blocks that enable you to repeatedly execute a set of instructions, making your programs more efficient and powerful. Instead of manually duplicating code for each iteration, you can use loops to:
Process multiple sensor readings
Generate patterns for LED displays
Handle collections of data
Create sequences of operations
Executes code a specific number of times.
Parameters:
Count (Number): How many times to repeat
Example:
Repeats code as long as a condition is true.
Parameters:
Condition (Boolean): The condition to check
Example:
Repeats code until a condition becomes true.
Parameters:
Condition (Boolean): The condition to check
Example:
Returns the current loop iteration number (0-based).
Returns:
Iterator (Number): The current loop iteration number
Example:
An iterator can not be used outside the loop.