Flow Control

There are a number of statements that can affect the flow of statement execution within a loop. In addition to the statements listed here, return and pass statements will terminate execution of a repeat loop (see Messages).

next repeat

Causes any statements following the next repeat statement, down to the end repeat, to be skipped and execution to jump directly back to the beginning of the current (innermost) repeat loop. Execution then continues with the next iteration.

exit repeat

Terminates execution of the current (innermost) repeat loop. Script execution proceeds with the next statement following end repeat.

exit handler

Terminates execution of the current handler, returning immediately to the handler that called it. This may also take the form exit handlerName where handlerName is the name of the current handler, or exit on, exit function, exit getProp, or exit setProp to exit from the corresponding type of handler.

exit all

Terminates execution of the current handler, the handler that called it, and all other handlers further up the call stack.

Exiting a Handler

exit handler

What it Does

Terminates execution of the current handler. Execution continues in the calling handler.

Examples

exit handler

exit myFancyFunction

Tech Talk

Syntax:

exit handlerOrFunctionName

exit [handler | script | on | function | getProp | setProp]

If handlerOrFunctionName or a handler type is given, it must match the name or type of the current handler.

exit all, exit to top

What it Does

Stops execution of all handlers (the current handler, plus the handler which called it, and so forth).

Examples

exit all

Tech Talk

Syntax:

exit all

exit to top

Passing Messages

pass command

What it Does

Passes the current message along to the next object in the message passing path (as described in the previous section). This terminates execution of the current handler.

Examples

pass message

Tech Talk

Syntax:

pass handlerOrFunctionName

pass {message | on | function | getProp | setProp}

If handlerOrFunctionName is given (rather than the generic term “message”), the name supplied must be the same as the name of the current handler. If on, function, getProp, or setProp is used, they must match the current handler type.

Pass ... and continue

What it does

Use pass ... and continue to pass the current message along to the next object in the message passing path, just as the pass command does, but allow the current handler to continue running after the message has been handled elsewhere.

Examples

pass message and continue

Tech Talk

Syntax:

pass handlerOrFunctionName and continue

pass message and continue

The current handler resumes executing after the message is handled by some other object later in the message passing path. Any value returned by the other object is available in the result immediately after the pass ... and continue command.

After executing a pass ... and continue command, any later attempt to pass that message (using any of the pass commands) will be unable to actually pass the message along, as no message is ever delivered to the same object twice.

Pass ... without helping

What it Does

Use pass ... without helping to pass the message along to the next object following the helpee in the message passing path. This differs from the pass command when used in a helper. In essence, the helper is saying “I’m not able to help with this message”. The helpers’ helpers are not given a chance to handle the message, but the message is passed to later helpers of the object being helped, and to other objects later in the message passing path.

Examples

pass message without helping

Tech Talk

Syntax:

pass handlerOrFunctionName without helping

pass message without helping

The current handler stops running when this command is executed.

Pass original message to ...

What it Does

Use pass original message to ... to pass the current message directly to some other object. This differs from other forms of the pass command, which pass the current message along to the next object in the message passing path.

Examples

pass original message to alterEgo

Tech Talk

Syntax: pass original message to object {and continue}

This form of the pass command is intended for use within undeliveredMessage handlers to try passing the original (undelivered) message to some other object for handling. If that object handles the message, that will be the end of it, and execution of the current handler will end. If the other object does not handle the message, execution will continue in the current handler. In this way an undeliveredMessage handler can attempt to deliver the original message to one or more other objects which may be able to handle it. See “Undelivered Messages” below.

If and continue is specified, the current handler resumes executing after the message is passed, whether or not it was handled by the other object.

 

This topic was last updated on February 06, 2020, at 03:03:11 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2020 Eggplant