Difference between revisions of "Continue"

From Wiki
Jump to: navigation, search
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
{{command header|Flow Control}}
 
{{command header|Flow Control}}
 
 
{{body|continue|Continue stops execution of code inside of a loop. Control is returned at the point of the next evaluation.}}
 
{{body|continue|Continue stops execution of code inside of a loop. Control is returned at the point of the next evaluation.}}
  
==== Example ====
+
==Example==
 
<pre>
 
<pre>
 
gosub testrandom  
 
gosub testrandom  
Line 24: Line 23:
 
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.
 
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.
  
== Releated Commands ==
+
== Related Commands ==
 
{| style="background:gainsboro; color:black; border: 2px #aaa solid;"
 
{| style="background:gainsboro; color:black; border: 2px #aaa solid;"
 
| Width=250px align=center | [[For]]
 
| Width=250px align=center | [[For]]
 
|}
 
|}
 
{{1.5only}}
 
{{1.5only}}
{{footer|}}
+
=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