For that specific example, you can usually turn lines like

return object ? true : null;

into

return Boolean( object );

as long as object != 0 and your code doesn't mind getting a false instead of a 
null. Most objects, as long as they exist, evaluate to Boolean true.

Really, though, the ternary operator is confusing enough as is. It tends to be 
a lot easier to read and maintain plain old if-statements in the long run.

-John Mark Hawley


> 
> From: "Helmut Granda" <[EMAIL PROTECTED]>
> Date: 2007/01/26 Fri PM 03:01:25 CST
> To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
> Subject: [Flashcoders] Shorhand for if statement without else statement
> 
> does anybody knows if there is any short hand for if statement without the
> else statement?
> 
> at the moment I am using
> 
> object ? true : null;
> 
> thanks...
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
> 

--
John Mark Hawley
The Nilbog Group
773.968.4980 (cell)

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to