In JavaScript, you can do this:
var a = null;
var b = "I'm a value";
var c = null;
var result = a || b || c;
And the "result" will get the value "b" because JavaScript shorts the "or" operator.
I want ColdFusion to execute a one-line idiom, and the best I can come up with is:
<cfif LEN(c) GT 0><cfset result=c></cfif>
<cfif LEN(b) GT 0><cfset result=b></cfif>
<cfif LEN(a) GT 0><cfset result=a></cfif>
Can anyone better than this?
source
share