# ArraySet

In a one-dimensional array, sets the elements in a specified range to the specified value. Useful in initializing an array after a call to ArrayNew. Returns a Boolean TRUE on successful completion.

See also ArrayNew.

### Syntax

    ArraySet(array, start_pos, end_pos, value)

##### array

Name of the array you want to change.

##### start_pos

Starting position in the specified array.

##### end_pos

Ending position in the specified array. If this value exceeds the array length, elements are accordingly added to the array.

##### value

The value you want to add to the range of elements in the specified array.

### Example

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

    <BODY>
    <H3>ArraySet 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, "Initial Value")>

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