(foo) ? foo() : (bar) ? bar() : (foobar) ? foobar() :
trace(sorry! no soup for you!);
I feel like I need a shower after that one. ;)
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
Gee ! didn't know it was such a dirty hack ! lol
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Steven Sacks
| BLITZ
Sent: 29 janvier 2007 13:14
To: Flashcoders mailing list
Subject: RE: [Flashcoders] Shorhand for if statement without else statement
Heh, that's nothing. I don't have the code available, but I once
wrote a ?: statement that was something like 16 deep.
Ah, those were the days. :)
-Andy
On 1/29/07, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:
(foo) ? foo() : (bar) ? bar() : (foobar) ? foobar() :
trace(sorry! no soup
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:
Usually ?: notation is used specifically for quickly choosing between
2 values (picking between 2 things inline). That's a case where you
really have to have an else, otherwise you wouldn't have a value to
represent the failure case of the IF part.
If you're doing logic that isn't inline in a
if ( condition){
}
?
- Original Message -
From: Helmut Granda [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Friday, January 26, 2007 9:01 PM
Subject: [Flashcoders] Shorhand for if statement without else statement
does anybody knows
hello :)
I don't understand you question ? why you don't use the if keyword ?
if ( isNaN(x) ) x = 0 ;
you can use the || operator too
function write ( txt )
{
var message = txt || empty message ;
trace(message) ;
}
write(hello) ; // output : hello
write() ; // output : empty message
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
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
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
does anybody knows if there is any short hand for if
statement without the else statement?
1. You can remove the braces.
I always use:
if (true) something();
But rarely use:
if (true) something();
else somethingElse();
because it can get lost visually in code.
2. Inline conditional
I
Hello :)
In FDT for example : cond ? methodA() : methodB() failed :)
The operator cond ? true : false is used to return a value but isn't really
the good solution to launch method i think :)
EKA+ :)
2007/1/26, Steven Sacks | BLITZ [EMAIL PROTECTED]:
does anybody knows if there is any
On 1/26/07, Steven Sacks | BLITZ [EMAIL PROTECTED] wrote:
does anybody knows if there is any short hand for if
statement without the else statement?
1. You can remove the braces.
I always use:
if (true) something();
I like it...
___
-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of eka
Sent: Friday, January 26, 2007 2:27 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Shorhand for if statement without
else statement
Hello :)
In FDT for example : cond ? methodA() : methodB() failed
( condition ) ( code );
Hot! I wonder how many of these shortcuts we can come up with that
nobody would use unless they were trying to show off to other
codemonkeys. :)
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or
Subject: Re: [Flashcoders] Shorhand for if statement without
else statement
Hello :)
In FDT for example : cond ? methodA() : methodB() failed :)
The operator cond ? true : false is used to return a value
but isn't really the good solution to launch method i think :)
EKA
16 matches
Mail list logo