MACROMEDIA COLFUSION MX 7-CFML Reference page 853

Cfml reference
Hide thumbs Also See for COLFUSION MX 7-CFML:
Table of Contents

Advertisement

The following table shows how variables are assigned:
Variable type
structure.any_simple_value
Boolean
Binary
Base64
structure.array
structure.nested_structure
structure.object
structure.query
Example
<!--- This code shows assignment by-value and by-reference. --->
// This script creates a structure that StructCopy copies by value. <br>
<cfscript>
// Create elements.
s = StructNew();
s.array = ArrayNew(2);
// Assign simple values to original top-level structure fields.
s.number = 99;
s.string = "hello tommy";
// Assign values to original top-level array.
s.array[1][1] = "one one";
s.array[1][2] = "one two";
</cfscript>
<!--- Output original structure --->
<hr>
<b>Original Values</b><br>
<cfoutput>
// Simple values <br>
s.number = #s.number#<br>
s.string = #s.string#<br>
// Array value <br>
s.array[1][1] = #s.array[1][1]#<br>
s.array[1][2] = #s.array[1][2]#<br>
</cfoutput>
// Copy this structure to a new structure. <br>
<cfset copied = StructCopy(s)>
<cfscript>
// Change the values of the original structure. <br>
s.number = 100;
s.string = "hello tommy (modified)";
s.array[1][1] = "one one (modified)";
s.array[1][2] = "one two (modified)";
</cfscript>
Assigned by
Value
Value
Reference
Reference
Reference
StructCopy
853

Advertisement

Table of Contents
loading

This manual is also suitable for:

Colfusion mx 7 - installing and using coldfusion mx

Table of Contents