Skip to content

Commands for Looping & Jumping Flow Control

Worksoft SaaS supports several commands (constructs) that would allow you to implement looping (iterations) and 'Jumping' flow control within your automated scripts.
  • Looping:
  • While-EndWhile (Iterate a block of code until the conditional evaluates to false)
  • For-EndFor (Then iterate over the block of code until the conditional evaluates to false, performing the incrementer after each iteration.)
  • Continue (Cause execution within a loop to immediately begin the next iteration)
  • Break (Cause execution within a loop to immediately exit)
  • Jumping Flow Control :      
  • GoTo (Jump to the given label)
  • GoToIf (If the conditional evaluates to true, jump to the given label)
  • Label (Serves as the target for goto/gotoIf statements)
  • SkipNext (Skips over the specified number of lines)
  • ExitTest (Causes the current run/test to immediately end)
The table(s) below list the commands in the ascending alphabetic order within each category along with a brief description of the purpose behind the command. By clicking on the hyperlinked command name in the table(s) below, you can review more detailed information about a specific command that includes the syntax for you to follow when using the commands. Please note that these constructs are supported within QaSCRIBE as well Worksoft SaaS application (Edit Test Script screen).
Command Purpose
break Cause execution within a loop to immediately exit. 'break' command must be used within a loop.
continue Cause execution within a loop to immediately begin the next iteration. 'continue' command must be used within a loop.
endFor It marks the end of a for block.
endForeach Marks the end of a foreach block.
endWhile Marks the end of a while block.
for Perform the 'initializer'. Then iterate over the block of code until the 'conditional' evaluates to false, performing the 'incrementer' after each iteration. 'for' command must always have 'endFor' at the end of the block.
foreach Iterate a block of code, once for each value. 'foreach' command must always have 'endForeach' at the end of the block.
goto Jump to the given label. 'label' is optional field.
gotoIf If the conditional evaluates to true, jump to the given label. 'label' is optional field.
skipNext Skips over the specified number of lines.
while Iterate a block of code written under the condition until the conditional evaluates to false. 'while' command must always have 'endWhile' at the end of the block.
label Serves as the target for goto/gotoIf statements. 'label' command must always have 'goto/gotoIf' statements.
exitTest Causes the current test to immediately end.

Feedback and Knowledge Base