On Sep 16, 2004, at 2:47 PM, Tels wrote:

-----BEGIN PGP SIGNED MESSAGE-----

Moin,

On Thursday 16 September 2004 23:37, Geoffrey Young wrote:
hi paul :)

I think this has come up before, but I'm not sure what the resolution
was.

I just came across (production) code that looks like this:

return 1 if $one == $two or return 0;

Just FYI:

I always wonder why someone would write such code.

Probably because they have some prejudice that the ternary ?: should never be used. (Maybe that it leads to unmaintainable code.)


Interestingly, while this snippet does what the author wanted, I'm pretty sure how it does it is completely different than they expect. It's actually equivalent to

if ($one == $two or return 0) {
        return 1;
}

right?


-kevin



Reply via email to