In perl:
(($n < 1) || ($n > 12)) is true when n is less than 1 or if n is greater
than 12. Try this:
for my $n (-5..17){
if (($n < 1) || ($n > 12)) {
print "True for \$n = $n\n"
} else {
print "False for \$n = $n\n"
}
}
Double check your logic. Are you sure you're
If really want negative then the 1 should be 0.
Wags ;)
-Original Message-
From: Naveen Parmar [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 13:20
To: [EMAIL PROTECTED]
Subject: Conditional Expressions
The following conditional expression tests whether the value
The following conditional expression tests whether the value of $number1 is
negative or greater than 12:
(($number1 < 1) || ($number1 > 12))"
Shouldn't this test whether the number is 0, negative, or > 12? Is this
unique to the way Perl uses numbers?
TIA,
- NP
___