in reply to Re: Re: variable set to 0 ? 0 : 1
in thread variable set to 0 ? 0 : 1
But here's how I usually write the ternary operator when clarity is a goal:
Yes, it seems unnecessarily expansive for this simple case... but I probably wouldn't do it for this simple case.return $status == 0 ? 0 : 1;
I would, and do, do this for situations such as:
Predicate and two lemmas, each on its own line.return @things = $obj->get_current_list_of_things() ? grep /$wanted/, @things : $obj->default_things; # o.k., it's a contrived example. gimme a break.
|
|---|