|
ColdFusion Home
Basic ColdFusionIntroductionColdFusion Installation ColdFusion Editors ColdFusion Syntax ColdFusion Includes ColdFusion Variables ColdFusion Variable Types ColdFusion If Statements ColdFusion Loops ColdFusion Datasource ColdFusion Database Queries ColdFusion Lists ColdFusion Arrays ColdFusion Redirect ColdFusion Debugging ColdFusion Error Handling Advanced ColdFusionColdFusion MailColdFusion Functions ColdFusion Components ColdFusion Web Services ColdFusion Upload File ColdFusion Read File ColdFusion Write File ColdFusion Append File ColdFusion Rename File ColdFusion Copy File ColdFusion Move File ColdFusion Delete File Cffile Parameters Using cffile Parameters ColdFusion FTP (cfftp) cfftp Cached Connections ColdFusion HTTP (cfhttp) ColdFusion Query of Queries ColdFusion Charts ColdFusion Summary ColdFusion AdminCF AdministratorCF Archive and Deploy CF Scheduled Tasks CF Mini Tutorial ColdFusion BooksColdFusion MX BibleMacromedia ColdFusion MX 7 Web Application Construction Kit Got a MySpace Page?Get "www.yourname.com" for your MySpace page. Learn how >>. |
ColdFusion Variable TypesColdFusion variables come in many different types. Firstly, all variables belong to a scope. There are many different scopes and each variable created in your application belongs to one of these scopes. Secondly, all variables can be either local or global. Thirdly, all variables are either persistent or non-persistent. Variable ScopesA variable's scope is determined by its origin. The scope determines a number of properties about the variable, such as its life span, timeout, and storage location, and therefore, how it can be used. Below is a list of the available scopes for ColdFusion variables:
"Scoping" your VariablesWhen you set or read a variable, it is good practice to tell ColdFusion which scope it belongs to. Although this is not required, it will avoid any confusion around whether the correct variable is being used or not. You may occasionally encounter two or more variables with the same name, but belonging to a different scope. To avoid the wrong one being used, you should scope your variables. You scope a variable simply by prefixing the variable name with the name of the scope (and separating them with a dot).
For example, to scope a session variable, you would do something like this:
Variable PersistenceThe following chart outlines the different variable scopes, whether they're local or global, and indicates whether they are persistent variables or non-persistent.
Enjoy this website?
Oh, and thank you for supporting Quackit! |
Featured Template:
(Build your websites in minutes!) |