Difference between revisions of "Continue"

From Wiki
Jump to: navigation, search
 
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{command header|Flow Control}}
== Continue ==
+
{{body|continue|Continue stops execution of code inside of a loop. Control is returned at the point of the next evaluation.}}
'''Flow Control'''
+
=== Synopsis ===
+
[[continue]]
+
=== Description ===
+
With [[continue]], you can continue to last line of any loop ( [[while]] and [[for]] ), so that it can start looping again. Ofcourse loop conditions must be valid in order to continue loop, otherwise it just jumps out from loop.
+
  
==== Example ====
+
==Example==
 
<pre>
 
<pre>
 
gosub testrandom  
 
gosub testrandom  
Line 26: Line 21:
 
</pre>
 
</pre>
  
When random is something else than 5, the if sentence is true and therefor [[continue]] gets executed. It jumps over [[display]] and [[return]] commands and continues [[for]] loop if its not over yet ( if %cnt is NOT 10 .
+
When random is something other than 5, the if sentence is true and therefore continue is executed. It jumps over the [[display]] and [[return]] commands and continues the [[for]] loop with it's next iteration. In the case that the evaluation is false, execution proceeds to the statement following the loop structure.
  
=== See Also ===
+
== Related Commands ==
{|
+
{| style="background:gainsboro; color:black; border: 2px #aaa solid;"
| width=200px | [[break]] || width=200px | [[while]] || width=200px | [[for]]
+
| Width=250px align=center | [[For]]
|}
+
----
+
{|
+
| Width=200px | [[Main_Page]] || Width=200px | [[Documentation]] || Width=200px | [[Documentation#Flow_Control|Flow Control]]
+
 
|}
 
|}
 +
{{1.5only}}
 +
=See Also=
 +
{{Flow Control}}

Latest revision as of 16:57, 5 September 2007

Synopsis

continue

Description

Continue stops execution of code inside of a loop. Control is returned at the point of the next evaluation.

Example

gosub testrandom 
sub testrandom 
{ 
  for %cnt 1 10 
  { 
    if #random % 10 <> 5 
      continue 
    display ok Five has been found! 
    return 
  } 
  display ok Nothing could be found! 
  return 
} 
display ok HALT! 
halt

When random is something other than 5, the if sentence is true and therefore continue is executed. It jumps over the display and return commands and continues the for loop with it's next iteration. In the case that the evaluation is false, execution proceeds to the statement following the loop structure.

Related Commands

For
Note: Only available in EasyUO 1.5+

See Also

Flow Control

  • Flow control commands allow scripts to make decisions based on the evaluation of boolean expressions.
break Jumps to first statement outside of loop
call Transfers execution to another script file
continue Jumps execution of a loop to next iteration
exit Exits a called script
for Creates a counting loop
gosub Transfers execution to the matching sub
goto Jumps to another part of the script given by a label
halt Stops the script
if Executes code based on the evaluation of an expression
pause Temporarily stops the execution of the current script
repeat..until Creates a loop that checks condition after execution
return Returns from a sub
stop Ends the script
while Creates a loop that checks condition before execution