[Omaha.pm] Using ||
Brian Edwards
dutch at tconl.com
Fri Mar 24 13:52:26 PST 2006
short circuit is good
j is correct - precedence counts
what's more readable?
$o_RS->determine_room_type($req_room_type) ||
$o_RS->determine_room_type();
$o_RS->determine_room_type($req_room_type)
|| $o_RS->determine_room_type();
$o_RS->determine_room_type($req_room_type) ||
$o_RS->determine_room_type();
hope they don't line wrap
(1 \n after or)
(2 \n before or)
(3 \n after and indented 2 \x20)
http://perldoc.perl.org/perlstyle.html
dutch
On Friday 24 March 2006 10:43 am, Jay Hannah wrote:
> Before
>
> > $room_type = $o_RS->determine_room_type($req_room_type);
> > if (!$room_type) {
> > $room_type = $o_RS->determine_room_type();
> > }
>
> After
>
> $room_type =
> $o_RS->determine_room_type($req_room_type) ||
> $o_RS->determine_room_type();
>
> (As long as 0 isn't a valid value. -grin-)
>
> j
>
> _______________________________________________
> Omaha-pm mailing list
> Omaha-pm at pm.org
> http://mail.pm.org/mailman/listinfo/omaha-pm
More information about the Omaha-pm
mailing list