Please enable JavaScript to view this site.

ESL Documentation

If you specify the leave loop statement as one of the action statements in a loop statement, ESL exits from the loop before the condition specified in the while or for statement has failed, and continues executions at the statement following the end loop keywords. For example, suppose you specify:

 

response to ...

    while (Int <= 5) loop

        action Action_Sub

        if (Action_flag != "OK") then

            leave loop

        end if

        copy (Int + 1) to Int

    end loop

    copy Action_flag to Flag_log

 

ESL repeatedly performs the action statements specified in the loop until the first test condition fails. However, if the value of Action_flag (a variable set by the action routine Action_Sub) is not "OK" at any point, ESL immediately leaves the loop. Execution continues at the statement following the end loop:

 

copy Action_flag to Flag_log

 

If you specify a leave loop statement, you must specify it within the definition of the loop itself. You cannot specify it in an action routine that is called from inside the loop. In the example shown above, the statement:

 

if (Action_flag != "OK") then

    leave loop

end if

 

could not be specified within the Action_Sub routine.

 

You can optionally specify a name in the leave loop statement. This name might identify the loop in which the leave loop is specified, or it might identify an outer loop. If you specify an outer loop, ESL leaves the specified outer loop and all inner loops. If you do not specify a name in the leave loop statement, ESL exits from the innermost loop that contains the leave loop statement, even if the innermost loop has a name.