Terminate execution of for or while loop
break terminates the execution of a
Statements in the loop after the
do not execute.
In nested loops,
break exits only from the
loop in which it occurs. Control passes to the statement that follows
end of that loop.
Sum a sequence of random numbers until the next random number is greater than an upper limit. Then, exit the loop using a
limit = 0.8; s = 0; while 1 tmp = rand; if tmp > limit break end s = s + tmp; end