NOTE: This invite-only release of SunSed Alpha is for testing purposes and in no way represents the final quality of the product — join the waitlist (~wait time: 2 weeks). SunSed release date is on March 11, 2022.

WHILE

Loop through a block of code as long as WHILE condition is TRUE.

WHILE (condition) {
// code to execute for each iteration
}

The WHILE condition is only evaluated at the beginning of each iteration. Since the condition is checked at the begging of each iteration, if the condition evaluates to FALSE for the first iteration then the WHILE block of code won't ever run. If your WHILE condition changes halfway through executing the WHILE loop's block of code, you should either use CONTINUE, BREAK or if possible wait for the next iteration, which checks the condition before running, to exist the loop.

Example

$x = 1
WHILE($x < 10) {
    PRINT "X is" . $x
    $x++
}
Copyright © SunSed LLC 2013-2021 All rights reserved.