Is it possible to undefine a variable in ColdFusion

coldfusionsyntax

Is it possible to undefine a variable in ColdFusion?

For example, something like this:

<cfset myVar = "lsajflksd" />
<cfoutput>
  <p>myVar is Defined? #IsDefined("myVar")#</p> <!--- Prints YES --->
</cfoutput>
<cfset Undefine(myVar) /> <!--- Doesn't exist... --->
<cfoutput>
  <p>myVar is Defined? #IsDefined("myVar")#</p> <!--- I want it to print NO --->
</cfoutput>

Best Solution

<cfset StructDelete(Variables, "myVar") />

Variables is the default scope for most variables in most contexts.

Related Question