Pound Signs
the existence of nested pounds implies a complex expression. For example, the
above CFML code could be rewritten to improve its readability:
<cfset FullName = "#FirstName# #LastName#">
<cfset Sentence = "The length of the full name
A common mistake is to put pound signs around the arguments of functions, as in:
<cfset ResultText = "#Len(#TheText#)#">
<cfset ResultText = "#Min(#ThisVariable#, 5 + #ThatVariable#)#">
<cfset ResultText = "#Len(#Left("Some text", 4)#)#">
These statements result in errors. As a general rule, never put pound signs around
function arguments.
Pound signs in general expressions
Macromedia recommends that you use pound signs only when necessary. The
following example shows the preferred method for referencing variables.
<cfset SomeVar = Var1 + Max(Var2, 10 * Var3) + Var4>
In contrast, note the following example, which uses pound signs unnecessarily:
<cfset #SomeVar# = #Var1# + #Max(Var2, 10 * Var3)# + #Var4#>
is #Len(FullName)#">
23
Need help?
Do you have a question about the COLDFUSION 5 - CFML and is the answer not in the manual?