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 Programming Environment documentationFor 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
  

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.

This loop is much faster than the PHP style of loop as well.

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

There are no comments on this page.

New comment
Reply
Provide feedback on this page
Comments are sent via email to me.