Quick Tip: When to Use Pound Signs

If you are DISPLAYING the variable, use pounds:

<cfoutput>
Hi #name#
</cfoutput>

If you are working the variable, don't:

<cfset shortName = left(name,6)>

If you are using the variable in a string, you must use pounds:

<cfset fullname = "#firstname# #lastname#">

Of course, you could also write the above as:

<cfset fullname = firstname & " " & lastname>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments