Please enable JavaScript to view this site.

ESL Documentation

You can define and use a block anywhere an action statement can be specified, including within action routines, loops, and conditional (if/else) action statements.

 

The begin statement begins a block. The end statement ends a block. The response definitions must lie between the begin and end of the block. For example:

 

begin DoYouWantToExit

    response to char "Y" from keyboard

        exit

    response to char "N" from keyboard

        leave block end DoYouWantToExit

 

If you use an identifier to name a block, as shown in the above example, it must be unique within the ESL program. There must be nothing else in the program with that name. If you are using nested blocks (described below), each block should be named.

 

If you specify an identifier in the begin statement, you must specify a name in the end statement. It must exactly match the name specified in the begin statement; for example:

 

begin Startup

    response to Go

        action Startup

    response to Stop

        leave block end Startup

 

You cannot specify action statements directly in blocks; all action statements must be specified in response definitions.

 

For example, you can specify:

 

begin

    response to Go

        make Hello visible

        send Startup to application end

 

but not:

 

begin            # WRONG - missing response definition

    make Hello visible

    send Startup to application end

 

You can define a block as resumable or guarded. These keywords are used to control how a block is exited. Although they are block definitions, they are detailed under Leaving (Exiting) a Block, which describes the ways you can control exiting a block.