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 loops

For loops

This for loop will assign $i with three and increment it by 1.

YASS
for($i = 3, $i < 10, 1)
  //Do something
end for
  

This for loop will assign $i to $j and increment $i by 2.

YASS
$j = 4
for($i = $j, $i < 10, 2)
  //Do something
end for
  

This for loop will not instantiate $i but will inform the loop that $i is the value to increment.

YASS
$i = 3
for($i, $i < 10, 1)
  //Do something
end for
  

As of version 1.4.2, for loops can be written in the exact syntax of a C-style for loop in that the $i++ can be used in place of the increment or decrement value. Placing a pre-decrement or pre-increment expression such as --$i will result in the value being changed before the for loop iterates.

YASS
for($i = 3; $i < 10; $i++)
  //Do something
end for
  

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

YASS
for($i = 3, $i < 10, 1)
  //Do something
end loop
  
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.

Comments powered by BalfComment

Feedback 👍
Comments are sent via email to me.