To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE/YASS documentationFunction data type

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

There are no comments on this page.

New comment
Reply
Code previewClose
Feedback 👍
Comments are sent via email to me.