# ArrayNew

Creates an array of between 1 and 3 dimensions. Array elements are indexed with square brackets: [ ].

Note that ColdFusion arrays expand dynamically as data is added.

### Syntax

    ArrayNew(dimension)

##### dimension

An integer value between 1 and 3.

### Examples

    <!--- This example shows ArrayNew --->
    <HTML>
    <HEAD>
    <TITLE>ArrayNew Example</TITLE>
    </HEAD>

    <BODY>
    <H3>ArrayNew Example</H3>

    <!--- Make an array --->
    <CFSET MyNewArray = ArrayNew(1)>
    <!--- Note that ArrayToList will not function properly
    if the Array has not been initialized with ArraySet --->
    <CFSET temp = ArraySet(MyNewArray, 1,6, "")>

    <!--- set some elements --->
    <CFSET MyNewArray[1] = "Sample Value">
    <CFSET MyNewArray[3] = "43">
    <CFSET MyNewArray[6] = "Another Value">

    <!--- is it an array? --->
    <CFOUTPUT>
        <P>Is this an array? #IsArray(MyNewArray)#
        <P>It has #ArrayLen(MyNewArray)# elements.
        <P>Contents: #ArrayToList(MyNewArray)#
    <!--- Note that the array has expanded dynamically
    to six elements with the use of ArraySet, even though
    we only set three values --->

    </CFOUTPUT>
    </BODY>
    </HTML>