|REBOL 3 Docs||Guide||Concepts||Functions||Datatypes||Errors|
|TOC < Back Next >||Updated: 6-Feb-2009 Edit History|
Function names are variables. In REBOL, a variable is a variable, regardless of what it holds. There is nothing special about function variables.
Furthermore, functions do not require names. You can create a function and immediately evaluate it, store it in a block, pass it as an argument to a function, or return it as a result from a function. Such functions are unnamed.
Here is an example that creates a block of unnamed functions:
funcs:  repeat n 10 [ append funcs func [t] compose [t + (n * 100)] ] print funcs/1 10 110
print funcs/5 10 510
Functions can also be created and passed to other functions. For instance, when you use sort with your own comparison, you provide a function as an argument:
sort/compare data func [a b] [a > b]
|TOC < Back Next >||REBOL.com - WIP Wiki||Feedback Admin|