View Single Post
  #4  
Old 10-04-2011, 05:37 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Better yet, || and && shouldn't return boolean, but rather the last-evaluated operand:

PHP Code:
function foo(bar,baz) {
  
bar bar || true;
  
baz baz || "Hey, how're you doin'? ;)";

e: You saw nothing.
e2: Actually, if || and && are using the same optimization as here, that would have to change for this to make any sense.

But perhaps we could just have ||= and &&=

PHP Code:
function foo(bar,baz) {
  
bar ||= true;
  
baz ||= "Hey, how're you doin'? ;)";

__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 10-04-2011 at 05:47 PM..
Reply With Quote