Please enable JavaScript to view this site.

ESL Documentation

Action Statement

Explicitly leave (exit) a block.

leave block [BLOCK_NAME]

BLOCK_NAME

The identifier for the block.

Description

You can specify a leave block statement inside a response definition that is inside a block. Note, however, that you must include the statement within the definition of the block itself; you cannot specify it in an action routine that is called from inside the block.

ESL will exit the block when the leave block statement is executed. Execution continues at the action statement (if any) immediately following the end statement for the block in which the leave block statement is specified.

Once a block has been exited, the responses in that block become inactive and cannot be executed again unless the block is re-entered.

You may specify a name in the leave block statement that indicates the outermost block that you want to leave. ESL exits the block specified in the leave block statement, and all blocks within that block. If you do not specify a name in the leave block statement, ESL exits only the innermost active block.

Do not use a name in a leave block statement in a nested resumable block.

Example

 

response to char from Remote

 begin

 

         response to ...

                 ...

 

         response to ...

                 leave block

 end

 

response to line "##" from Remote

 begin ChoiceA

         response to ...

         leave block ChoiceA

 end ChoiceA

 

# The following is an example that shows how to force the

# user to hit only the escape key "\e\e", and how to

# handle other keys that generate the first escape but

# something different for the second (e.g., up arrow is

# "\eu"):

 

begin guarded LeaveOnlyOnEscape

 response to char "\e" from keyboard

 # the first character of 2

 

         begin VerifyEscape

                 response to char "\e" from keyboard

                 # 2 in a row - it is the Escape

                         leave block LeaveOnlyOnEscape

                 response to char from keyboard

                 # any other second character, not Escape

                         leave block VerifyEscape

         end VerifyEscape

 

end LeaveOnlyOnEscape

See Also

begin BLOCK Action Statement