Please enable JavaScript to view this site.

ESL Documentation

Action Statement

Explicitly leave (exit) a loop.

leave loop [LOOP_NAME]

LOOP_NAME

The identifier for the loop.

Description

The leave loop action statement can be one of the action statements in a for each member loop, for each selected line loop, for loop, or while loop statement.

Upon execution, ESL will exit from the loop before the condition specified in the for or while statement has failed, and will continue execution at the statement (if any) following the end loop keywords.

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.

You can 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.

Example

 

response to Help2

 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

See Also

for each member loop Action Statement

for each selected line loop Action Statement

for loop Action Statement

while loop Action Statement