Jamie Balfour

Welcome to my personal website.

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

Official ZPE/YASS documentationFor to loops

As well as the standard for loop, YASS also supports an alternative syntax, similar to VB.NET, that uses the to keyword:

YASS
for($i = 0 to 10)
  //Do something
end for
  

As with all loops, for loops may be terminated by end loop.

Performance differences

In reality, the YASS for to loop is considerably higher performance compared with the C-style version, especially when using a native build of ZPE. This is because unlike the standard C-style for loop, the for...to loop will not perform any checking of conditions on each iteration.

ZPE 1.12.4+

ZPE 1.12.4 onwards also support evaluatable expressions in both parts of the loop:

YASS
for($i = 0 to $x + 3)
  //Do something
end for
  
YASS
for($i = 0 to count($x) - 1)
  //Do something
end for
  
Comments

There are no comments on this page.

New comment

Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days.

Comments powered by BalfComment

Feedback 👍
Comments are sent via email to me.