next up previous contents index
Next: continue Up: Control Structures Previous: dowhile   Contents   Index

break

break [ n]

In a loop, the break statement will exit the loop. If an integer n is given, control reaches the bottom of the n'th enclosing loop.

Example:
while x <= 100
  while y <= 50
    while z <= 20
       statements
       if (x + y + z == 10)
           break 2
       end
    end
  end
# break will jump here
end



Stephen R. Whiteley 2024-09-29