Keywords
while
Repeats a block for as long as a condition holds. `break` leaves the loop and `continue` starts the next pass. Give it an exit you control. The interpreter enforces its own resource limits and reports a diagnostic when one is passed rather than returning a partial result, and a `break` written outside a loop is rejected rather than ignored.
Syntax
while <condition> {
...
break
...
continue
...
}
Example
indicator("While Loop Example", overlay=true)
// Initialize a counter variable
static int count = 0
// Run while loop until count reaches 5
while count < 5 {
count := count + 1
}
// Plot the final count
plot(count, title="Counter", color=color.blue)