Jamie Balfour

Welcome to my personal website.

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

Official ZPE/YASS documentationC-style syntax

YASS has supported compilation of a C style syntax since a very early version. It is therefore possible to compile YASS syntax with C like constructs in it (remember that C is one of the languages to inspire ZPE).

Although this documentation article has not yet explained how ZPE functions work, this sample discusses how to write a ZPE function in the C syntax (note there are no semi-colons but there are braces, positioning its syntax close to the C-style syntaxes):

YASS
function main() {
  $x = 10
}
    

The use of the braces means that end function is not required.

Almost every, if not every, construct in ZPE, supports the C style notation as well as the standard (sugary syntax). For example, for loops support it:

YASS
for ($i = 0; $i < 10; $i++) {
  $x = 10
}
    

Further to this, ZPE 1.9.7 (Galashiels, July 2021) added C-style variable declarations:

YASS
string $str = "Hello world!"
print($str)
    
Comments
Feedback 👍
Comments are sent via email to me.