up previous next
func

Anonymous function

Syntax
Func ... EndFunc
  returns FUNCTION

Description
This syntatic structure defines an anonymous function, i.e. a function without a name. Anonymous functions can be passed as parameters and assigned to variables. Note that Func...EndFunc can also be used inside function definitions.

Example
/**/  square := Func(x) Return x^2; EndFunc;
/**/  square(3);
9

/**/  SortedBy(["zzz", "x", "yy"], Func(x,y) Return len(x)>len(y); EndFunc);
["zzz", "yy", "x"]

See Also