Perl Programming/Keywords/while
Appearance
The while keyword
[edit | edit source]while is the statement that uses the EXPRESSION, called the condition, to loop through a block until the condition is true. It is the opposite of the until statement.
Syntax
[edit | edit source] while EXPRESSION
Examples
[edit | edit source]
The following two print statements
$i = 5;
print $i++ while $i <= 10;
$j = 5;
print $j++ until $j > 10;
return the same:
5678910 5678910