syntax idea: simplifed ifs

Dan Dan_member at pathlink.com
Fri Apr 14 05:05:58 PDT 2006


In ECMAScript itself, you can write code like:

a && a.doSomething();
or
a = a || defaultValue;

It feels so much better than:

if(a) a.doSomething();
if(!a) a = defaultValue;

Maybe because it doesn't need indentation.  Maybe because it falsely makes me
feel better about branching.  Maybe it's 'cause logicals are just sexy.





More information about the Digitalmars-d mailing list