Skip to content

NEP3 Abbreviated Functions

Greg Hewgill edited this page Jul 25, 2019 · 1 revision

Often is it necessary to write a function that only returns a (computed) value. This is currently written as follows:

FUNCTION foo(x: Number): Number
    RETURN x * x
END FUNCTION

This proposal extends the FUNCTION definition to allow writing the following:

FUNCTION foo(x: Number): Number := x * x

The addition of the := symbol eliminates both the RETURN and END FUNCTION keywords.