I see all three notations used frequently, and I’m wondering what the differences are between them:
<cfset var foo = "bar" />
<cfset local.foo = "bar" />
<cfset variables.foo = "bar" />
<cfset arguments.foo = "bar" />
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
var and local are the same scope and they are available only to the method/function in which they are declared. The local scope is new to CF 9 before that you used var to create variables that only existed in the method.
Variables is available to the entire cfc or cfm page in which they are declared and any included templates.
arguments is used for arguments passed into a method/function and only exists with in it.