Last active
August 29, 2015 14:14
-
-
Save aliaspooryorik/a4c190576ffef4a7bf54 to your computer and use it in GitHub Desktop.
scoping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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