[Omaha.pm] if ($a > $b) { $b = $a }

Hugh Jarce hjarce2001 at yahoo.com
Thu Feb 3 14:51:03 PST 2005


"Tegels, Kent" wrote:
> Well, there's the dreaded:
> $b = ($a > b$ ? $a : $b);
>
> But that's less readable than what you have.

This expression returns the maximum of $a and $b:

    [ $a => $b ] -> [ $a <= $b ]

Though less readable than your version, it's more enjoyable to read. :-)
As much as I like it, I can't recommend it for production code.

Hugh



		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 



More information about the Omaha-pm mailing list