Function RETURN statement

Language reference ›› Procedures and functions ››
Parent Previous Next

In some Pascal-like languages such as MODULA or OBERON, there's a special statement for functions:

return-statement = RETURN expression .

It is implemented in PMP as an extended syntax. If the “Extended syntax” project's option is not active it will produce a compilation error.

The following code:

IF <condition> THEN
 RETURN <expression>;

is strictly equivalent to:

IF <condition> THEN
   RESULT := <expression>;