Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Official ZPE/YASS documentationFunction overwriting

Functionalities provided by the language can be overwritten by simply defining a new one.

None of the "core functions", "reference functions" or "object functions" can be overwritten (although many of them have alternatives which can indeed be overwritten). No basic language constructs can be overwritten either.

Where it can be achieved, it is done by simply declaring the function within the code.

In this example, we are overwriting the multiply (removed as of version 1.3.7) function:

YASS
function multiply($n, $times)
  //Multiply
  $out = 0
  for($i = 0, $i < $times, 1)
    $out = $out + $n
  end for

  return $out
end function

Here is another example:

YASS
function input_validate($x, $pattern)
  return string_matches($x, $pattern)
end function
Comments
Feedback 👍
Comments are sent via email to me.