Until Loop
Understand what an until loop is with the help of an example and illustration in this lesson.
We'll cover the following
What is an until
loop?
The until
loop continues to execute the statements in its block as long as the condition is false.
The syntax is as follows:
Again, the curly braces surrounding the body of the until
loop indicate that multiple statements can be executed as part of this loop.
Example
Take a look at the until
loop code:
$y=0;until ( $y > 5 ) { # the until loop will run "until" the condition is false$y += 1;print "The value of y is: $y\n";} #the loop will iterate 6 times
Explanation
Below is an illustration of the code above to help you better understand the logic.