Perl Programming/Keywords/until

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: untie Keywords Next: use

The until keyword

[edit | edit source]

until is the statement that uses the EXPRESSION, called the condition, to loop until the condition is false. It is the opposite of the while statement.

Syntax

[edit | edit source]
  until EXPRESSION

Examples

[edit | edit source]
The code
$i = 5;
print $i++ while $i <= 10;
$j = 5;
print $j++ until $j >  10;
prints the same twice:


See also

[edit | edit source]
Previous: untie Keywords Next: use