Lipi Reference Lipi

Keywords

while

The while statement allows the conditional iteration of a local code block.

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)