#!/usr/bin/perl -w
for($i=0; $i<10; $i++)
{
print($i."\n");
#last will end up the loop
if($i == 7)
{
last;
}
#next
if($i == 5)
{
next;
}
}
print("\nSecond loop ...\n");
for($i=0; $i<10; $i++)
{
print($i."\n");
#next
if($i == 5)
{
next;
}
}
print("\nThird loop ...\n");
# put the label out
out:for($i=0; $i<3; $i++)
{
print($i."\n");
In:for($j=0; $j<3; $j++)
{
print($j."\n");
if($j==1)
goto out;
}
}
Saturday, October 18, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment