Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Added some documentation. #11

merged 1 commit into from

2 participants


Added some more documentation about ColdFusion scopes to AboutVariables.cfc

@bittersweetryan bittersweetryan merged commit 4a660a4 into nodoherty:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 23, 2011
  1. @boyzoid
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 0 deletions.
  1. +21 −0 Koans/AboutVariables.cfc
21 Koans/AboutVariables.cfc
@@ -14,6 +14,27 @@ component extends="mxunit.framework.TestCase"{
public void function testScoping(){
+ /*
+ ColdFusion has many 'scopes' in which it stored variables.
+ Each of these scopes is treated like a structure
+ When you do not 'scope' your varaible (such as calling instaed of just foo) ColdFusion
+ will seacrh through each of the scopes until it finds a variable with that name.
+ As such, you should ALWAYS scope your variables.
+ ColdFusion scopes include:
+ application: values stored in application scope are available in any .cfm or .cfc file under the same cfapplication
+ application scope is typically used to store information specifci to the application ans is availabel to all users.
+ session: values stored in session scope are available in any .cfm or .cfc file for the existing session
+ session scope is typically used to store information specific to a single user or session
+ request scope: values stored in the request scope area vailable in any .cfm or .cfc file during a sinlge request.
+ form scope: values from a form post are stored in the form scope and are available in any .cfm or .cfc file during a single request
+ url scope: values from the query string are stored in the url scope and are available in any .cfm or .cfc file during a single request
+ cgi scope: this read-only scope contains values about the request, such as user_agent, server_name, etc. and are available in any .cfm or .cfc file on every request.
+ arguments scope: arguments passed into a function are stored in a structue and are availabelo only inside the function to which they are defined.
+ If you do not use named arguments, the structure will contain keys that will be numbered with how many arguments are passed.
+ variables scope: variables that are set on .cfm or .cfc page are automatically stored in the variables scope if no other scope is given.
+ */
var foo = "local foo"; = "arg foo"; = "variables foo";
Something went wrong with that request. Please try again.