Difference between revisions of "Break"

From Scriptwiki
Jump to: navigation, search
m (added category)
 
Line 11: Line 11:
 
==See Also==
 
==See Also==
 
* [[Continue|/continue]]
 
* [[Continue|/continue]]
 +
[[Category:Commands]]

Latest revision as of 01:38, 7 April 2008

Breaks out of a while loop.

/break

Example

var %i = 1
while (1) {
  inc %i
  if (%i == 12) { break }
}
echo Break at %i

The above script would break out of the while loop when %i reached 12. If the script did not have a break command, it would turn into an infinite loop as the statement 1 will always be true.

See Also