Until Loop





The until statement is just like while, but it repeats a block of statements until a specified condition becomes true. In other words, the until statement executes the block as long as that condition is false.
Here is an example that illustrates a typical use of an until loop:
#!/user/local/bin/perl
#process Commands eq :quit")
until($command eq "quit")
{
$command =<STDIN>:#read command
chop $command;#get rld of newline
print "$command\n";
When you run this program, it continues accepting command (and printing them) until you type quit. At that point, the expression ($command eq "quit") becomes true and the until loop ends.
Domain Name Search
|