in reply to Re: Re: variable set to 0 ? 0 : 1
in thread variable set to 0 ? 0 : 1
for completness sake.return $status && 1; # canonize false, leave true as-is
update: I got that backwards. && returns the last part evaluated, and skips the right side if the left already determines the outcome. So, if $status is false it returns it unchanged; if true it evaluates the right hand side and gets a numeric 1. It canonizes true, leaves false as-is.
$status || 0; will return $status unchanged if true, and check the rhs if false. So that canonizes false and returns true unchanged.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: another variation (variable set to 0 ? 0 : 1)
by sauoq (Abbot) on Sep 07, 2002 at 04:51 UTC | |
|
Re: another variation (variable set to 0 ? 0 : 1)
by sauoq (Abbot) on Sep 10, 2002 at 00:17 UTC |