You can create an empty structure implicitly, as in the
following example:
<cfset myStruct = {}>
You can also create a structure by assigning data to a variable.
For example, each of the following lines creates a structure named myStruct with
one element, name, that has the value Adobe Systems
Incorporated.
<cfset coInfo.name = "Adobe Systems Incorporated">
<cfset coInfo["name"] = "Adobe Systems Incorporated">
<cfset coInfo = {name = "Adobe Systems Incorporated"}>
When you use structure notation to create a structure, as shown
in the third example, you can populate multiple structure fields.
The following example shows this use:
<cfset coInfo={name="Adobe Systems Incorporated", industry="software"}
ColdFusion does not allow nested implicit creation of structures,
arrays, or structures and arrays. The following line, for example,
generates an error:
<cfset myStruct = {structKey1 = {innerStructKey1 = "innerStructValue1"}}>
Similarly, you cannot use object.property notation on the left
side of assignments inside structure notation. The following statement,
for example, causes an error:
<cfset myStruct={structKey1.innerStructKey1 = "innerStructValue1"}>
Instead of using these formats, use multiple statements, such
as the following:
<cfset innerStruct1 = {innerStructKey1 = "innerStructValue1"}
<cfset myStruct1={structKey1 = innerStruct1}>
You cannot use a dynamic variable when you create a structure
implicitly. For example, the following expression generates an error:
<cfset i="coInfo">
<cfset "#i#"={name = ""Adobe Systems Incorporated"}>