Skip to content

Lambda#

Introduction#

Lambda functions#

To declare a lambda function:

1
2
3
Lambda [ : ReturnType ] ( Parameters )
    ...Statements...
End

Lambda declarations must appear within an expression, and therefore should not start on a new line.

For example:

1
2
3
4
5
Local myLambda:=Lambda()
   Print "My Lambda!"
End

myLambda()

To pass a lambda to a function:

1
2
3
SomeFunc( Lambda()
   Print "MyLambda"
End )

Note the closing ) after the End to match the opening ( after SomeFunc.