Adobe COLDFUSION 9 Manual page 130

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
The CFML Programming Language
/**
* custom metadata for a cfc defined using annotation as well as key-value pairs
* @cfcMetadata1 "cfc metadata1"
*/
component cfcMetadata2 = "cfc metadata2"
{
/**
* custom metadata for a property defined using annotation as well as key-value
pairs
* @propMetadata1 "property metadata1"
*/
property type="numeric" name="age" default="10" propMetadata2="property
metadata2";
/**
* custom metadata for a function/argument using both annotation and key-value pairs
* @arg1.argmdata1 "arg metadata1"
* output true
* @fnMetadata1 "function metadata1"
*/
public string function foo(required numeric arg1=20 argmdata2="arg metadata2")
fnMetadata2="function metadata2"
{
}
}
Explicit function-local scope
ColdFusion has an explicit function-local scope. Variables in this scope exist only during the execution of the function
and are available only to the function. To declare a function-local scope variable either specify the Local scope name
when assigning the variable, or use the var keyword. Also, you can now use the var keyword anywhere in a function
definition, not just at the top.
Note: Because it is now a scope name, do not use local as a variable or argument name. If you do so, ColdFusion ignores
the variable or argument.
The following code shows the use of the function local scope:
<cffunction name="foo" output="true">
<cfset var x = 5>
<cfset local.y=local.x*4>
<cfset var z=[local.x,local.y]>
<cfset local.u.v={z="2"}>
<cfset zz="in Variables Scope">
<cfdump var="#local#">
</cffunction>;
For more information about function local scope see
Using system level functions
In the
mode, you can now use the following basic language constructs:
<cfscript>
• throw
• writedump
writedump(getmetadata(this));
return arg1;
"Using ColdFusion
Last updated 8/5/2010
Variables" on page 38.
125

Advertisement

Table of Contents
loading

Table of Contents