Menu

The Ternary Operator and Railo

19 July 2009
The Ternary Operator and RailoWith CF9 beta out the blogs have been busy looking at all the new features. There has been some great reads and they've substituted for the fact that I haven't had the time to look at the new version myself yet.Whats also been a good experience is that they have given me the chance to learn new stuff about Railo that I hadn't realised. The first one is that it already has Ternary Operator. This is a way of writing an IF/ELSE block in a single statement: [sourcecode language="plain"]$variable = condition ? if true : if false[/sourcecode]So in my CFSCRIPT block I have:[sourcecode language="plain"]<cfscript>val = (true ? "A True Response" : "A False Response");writeOutput(val);</cfscript>[/sourcecode]Andy Jarrett's Picture