|
|
It is more like a strongly typed language where one has to initialize
ones variables before one can use them. In CF this initializes the
variable so that it is local to the function, otherwise the variable
will be global and if one does not account for the global nature, very
hard to track bugs can be introduced into the code.
The best practice is to ALWAYS initialize local variable and to ALWAYS
scope variables so that is is explicit when one is using local and one
is using global 'variables' scoped variables.
<cffunction...>
...
<cfset var myLocalVar = ...><!--- initializes a local var --->
<cfset variables.myGlobalVar = ...> <!--- initializes a global var --->
<cfsomething myLocalVar ...><!--- uses the local var --->
<cfsomethingelse variables.myGlobalVar...><!--- uses the global var --->
|
|