return. Returning from a method   [3.4.5]

^return[result value]

If called force finishes a Parser method execution, in which the
^return[] call code is written. The result of the method will be what was output before the ^return[] call or the current value of $result variable. The call ^return[result value] is equivalent to $result[result value] ^return[].

-return- ^return[] }
good]{ $exit }
normal]{ $exit }
bad]{ $exit }

Value: $value ^if($value eq 'bad'){ $exit } -passed-


Value: good   -passed-
Value: normal -passed-
Value: bad    -return- 

^return[] call code is written in the @main[] method, so the return is made from it. To do this, the execution of the @check[] method is also terminated, so there is no -passed- for the value bad in the output.

Copyright © 1997–2017 Art. Lebedev Studio | Last updated: 20.04.2017