Variable Assignment


In CFML, you assign variables by using the <cfset> tag. In a <cfscript> block, you use a simple assignment statement followed by a semicolon, as follows:

 <cfscript>  // simple variable assignments  x=1;  y=2; </cfscript> 

NOTE

As with CFML tags, <cfscript> code is not case sensitive. Every statement in a script block is followed by a semicolon, much like in Java or JavaScript. Comments in a script block are preceded by //.


As with the <cfset> tag, temporary variables are not needed in a ColdFusion script block. For example, you can use a structure or array function without the need for an equals sign (=):

 <cfscript>  MyStruct = StructNew();  StructInsert(MyStruct,"new key","new value"); </cfscript> 



Macromedia ColdFusion MX 7 Certified Developer Study Guide
Macromedia ColdFusion MX 7 Certified Developer Study Guide
ISBN: 0321330110
EAN: 2147483647
Year: 2004
Pages: 389
Authors: Ben Forta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net