Exit a [while](/microbit/js/while) or [for](/microbit/reference/loops/for) loop before the loop is complete.
### Touch Develop syntax
**break**
### Example: count to a random number
The following example counts from 0 to a random number from 0-9. When the for loop counter equals the random number (`i = x`), the `break` statement exits the loop: