programming-examples/perl/Statement/Nest if statement into for loop.pl

20 lines
338 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!C:/perl/bin
for($number = 1; $number <= 3; $number++)
{
print "\nLoop number: $number";
if ($number < 2)
{
print "\n\$number is less than 2\n\n";
}
elsif ($number > 2)
{
print "\n\$number is greater than 2\n\n";
}
else
{
print "\n\n\$number equals 2\n\n";
}
}