The number of times instructions are repeated based on a predefined value or until a condition has been met.
The above example is code that enables a Micro:Bit to be used as a step counter with a daily goal. For the purpose of this demonstration, the daily goal has been set to 10 steps, but could be set to whatever. We can see that a conditional statement is used to monitor for the defined count of 10 steps. Once 10 steps are reached, the display will show a "bulls eye" image indicating that the daily goal has been reached. The video below shows the code in action. This example corresponds with Mathematics C3.1, C3.2 and Health and Physical Education B1, B2, B3, D1, D2, and D3.
*A Micro:Bit is a pocket-sized computer that introduces you to how software and hardware work together. It has an LED light display, buttons, sensors and many input/output features that you can program and physically interact with. Micro:Bits are available throughout RCDSB.
To learn more about the Mico:Bit, please see the Coding Platforms Section of this website.