Difference between revisions of "Break"

From Wiki
Jump to: navigation, search
(See Also: added reference)
Line 1: Line 1:
__NOTOC__
+
{{command header|Flow Control}}
== Break ==
+
{{body|Break|''break'' can be used to immediately exit any loop structure.}}
'''Flow Control'''
+
=== Synopsis ===
+
Break
+
=== Description ===
+
[[break]] can be used to immediately exit any loop structure.
+
  
 
==== Example ====
 
==== Example ====
Line 25: Line 20:
 
%Test will hold the value of 7, notice how we break out from the loop when %Test is 7.
 
%Test will hold the value of 7, notice how we break out from the loop when %Test is 7.
  
=== See Also ===
+
{{footer}}
{|
+
| width=200px | [[while]] || width=200px | [[for]] || width=200px | [[repeat..until]] || width=200px | [[continue]]
+
|}
+
----
+
{|
+
| Width=200px | [[Main_Page]] || Width=200px | [[Documentation]] || Width=200px | [[Documentation#Flow_Control|Flow Control]]
+
|}
+

Revision as of 10:41, 27 August 2005

Synopsis

Break

Description

break can be used to immediately exit any loop structure.

Example

set %Test 1

while %Test < 10
{
;Code between these brackets, gets executed, while %Test is smaller than 10
;When its 10, it wont jump back to first bracket.
if %Test = 7
   break
set %Test %Test + 1
}
display ok %Test $
halt

%Test will hold the value of 7, notice how we break out from the loop when %Test is 7.

See also

Main Page Documentation