Skip to content

Instantly share code, notes, and snippets.

@aliaspooryorik
Last active August 29, 2015 14:14
Show Gist options
  • Save aliaspooryorik/a4c190576ffef4a7bf54 to your computer and use it in GitHub Desktop.
Save aliaspooryorik/a4c190576ffef4a7bf54 to your computer and use it in GitHub Desktop.
scoping
<cfset URL.id = 123>
<cffunction name="testa">
<cfargument name="id" type="numeric" required="no">
<cfreturn isDefined("id")>
</cffunction>
<cffunction name="testb">
<cfargument name="id" type="numeric" required="no">
<cfreturn isDefined("arguments.id")>
</cffunction>
<cffunction name="testc">
<cfargument name="id" type="numeric" required="no">
<cfreturn structkeyexists(arguments, "id")>
</cffunction>
<cfoutput>
#testa()# <!--- returns true ---><br>
#testa(987)# <!--- returns true ---><br>
<hr>
#testb()# <!--- returns false ---><br>
#testb(987)# <!--- returns true ---><br>
<hr>
#testc()# <!--- returns false ---><br>
#testc(987)# <!--- returns true ---><br>
<hr>
</cfoutput>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment