in reply to Re: Re: Can If-then conditions do ($a = $b = $c) type expressions?
in thread Can If-then conditions do ($a = $b = $c) type expressions?
or better yet:$a = 5; $b = 5; $c = 5; if ((($a == $b ) + ($a -1)) == $c) { print "yes!!!\n"; }
Again, I'm not saying I'd use this... ;0)# given three equal variables if (($a == $b ) == ($b == $c)) { print "yes!!!\n"; } # as pointed out by Sidhekin # given three different variables if (($a == $b ) == ($b == $c)) { print "yes!!!\n"; } # still prints 'yes!!!\n'. Why? # both sides evaluate to false or 0, # and 0 == 0 evaluates to true
Update: Thanks to Sidhekin for pointing out my misstep. It does work with 2 same and 1 different variable. ;0)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Amel)Re: Re: Re: Can If-then conditions do ($a = $b = $c) type expressions?
by Sidhekin (Priest) on Apr 25, 2002 at 20:28 UTC |