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 documentationGlobal scope

ZPE/YASS has had a global scope since a very early stage in its development. Whilst using global variables is not always very useful, there are times when they are needed.

The ZPE runtime defines a global function (known as globalFunction) that is:

  • The parent of all top-level functions in code
  • The parent of all global variables
  • The owner of all top-level structures

The following code sample demonstrate this:

function main()

  $test1 = 10

end function

function displayIt()


end function

function getValue()

  return 2

end function

$test1 = getValue()

The $test1 variable is defined within the global scope since it is not defined within any function definition. The main and displayIt functions reference the $test1 variable within the global scope, not within their own scope. This means that the $test1 variable is changed within the global scope and not the local scope.

Notice as well, the $test1 variable is defined after the getValue function. If it were defined before this function, the runtime would have access to the function and would throw an error.

Everything as a function

The concept of first-class citizens has been available in ZPE/YASS since early days when lambda functions came. As a result, the move to the everything as a function initiative means that ZPE has gained higher performance as well as flexibility.

ZPE/YASS strives to ensure that the globalFunction - encompasing all other functions - allows for the same flexibility as other functions.


There are no comments on this page.

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