[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Omaha.pm] Using ||
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@pm.org
> http://mail.pm.org/mailman/listinfo/omaha-pm