Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 08/06/2010 at 16:06, xxxxxxxx wrote:
Is there any benefit over doing an if statement like this?
x == 10 ? y = 16 : y = 5;
as opposed to
if (x = 10) { y = 16; } else { y=5; }
Thanks,
Shawn
On 09/06/2010 at 02:27, xxxxxxxx wrote:
The only real benefit is that it's shorter. You can also use the ? operator in function calls.
Example:
MyFunction(x == 10 ? 16 : 5);
if (x == 10) MyFunction(16); else MyFunction(5);
cheers, Matthias