Back when I was using AS2 and Javascript "||" operator was useful to me. I was so glad when AS3 brought default parameters.
var value:String = foo || bar;

-- Keith H --
www.keith-hair.net




Steven Sacks wrote:
Dave, come on. Take a stand on the issue. Stop straddling the fence.

Pick a side. Im or Ex?

I'm not about writing cryptic PERL-like statements, but writing != null is a waste of time. It's obviously a null comparison (by nature of it being an instance). Calling it out as such is redundant.

It also lends itself to very readable code with inline ORs.

var value:String = foo || bar;

If foo is null, value = bar.  Great for default values such as with XML.

var value:String = x...@foo || "";

Very readable and so much better than

var value:String = "";
if (x...@foo != undefined) value = x...@foo;
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to