The function data type is one of the most powerful data types in ZPE/YASS. In ZPE/YASS functions are first-class citizens and can be operated on similarly to other data types.
Functions, although a reference type, do not provide any reference functions.
The following is an example of the function data type in action, including using it with TYPO:
YASS
$a = function(){ print("Hello world!") } //Using TYPO (version 1.9.7+) declare b as function = () => { print("Hello world!") }
Variables containing functions are called lambda or anoymous functions. These variables can be 'called' like a standard function:
YASS
$printer1 = function(){ print("Function A!") } $printer1() declare printer2 as function = () => { print("Function B!") } printer2()
Comments