throw
This function discontinues executing and skips executing all further code until the catch() or catch if() function calls or the end program have been encountered. One variable of any valid type (including bigger payloads packed in sets) may be thrown like a frisbee and caught and returned by the corresponding catch functions.
Indirect parameter passing is disabled
0 - 1
No. | Type | Description |
---|---|---|
Opt. 1 input |
valid types | Frisbee value This value will be returned by the next catch() or catch if() function. Default value: 0 |
define procedure( foo )
{
echo("Test throw");
throw( "my Frisbee");
echo("This text does not appear");
}
foo;
echo("This text does not appear, too");
catch( c[] )
{
echo("Caught: ", c[] );
}
else: echo("Nothing thrown");
Test throw
Caught: my Frisbee