| Contents > Developing ColdFusion MX Applications > Using Arrays and Structures > About structures > Structure notation |
|
|
|
|
||
ColdFusion supports two types of notation for referencing structure contents. Which notation you use depends on your requirements:
Notation |
Description |
|---|---|
Object.property |
You can refer to a property, prop, of an object, obj, as obj.prop. This notation is useful for simple assignments, as in this example: depts.John="Sales" Use this notation only when you know the property names (keys) in advance and they are strings, with no special characters, numbers, or spaces. You cannot use the dot notation when the property, or key, is dynamic. |
Associative arrays |
If you do not know the key name in advance, or it contains spaces, numbers, or special characters, you can use associative array notation. This notation uses structures as arrays with string indexes; for example: depts["John"]="Sales" depts[employeeName]="Sales" You can use a variable (such as employeeName) as an associative array index. Therefore, you must enclose any literal key names in quotes. For information on using associative array references containing variables, see Dynamically constructing structure references. |
|
|
||
| Contents > Developing ColdFusion MX Applications > Using Arrays and Structures > About structures > Structure notation |
|
|
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/arrays21.htm