# ArraySwap

Swaps array values for the specified array at the specified positions. ArraySwap can be used with greater efficiency than multiple CFSETs.

Returns a Boolean TRUE on successful completion.

### Syntax

    ArraySwap(array, position1, position2)

##### array

Name of the array whose elements you want to swap.

##### position1

Position of the first element you want to swap.

##### position2

Position of the second element you want to swap.

### Example

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

    <BODY>
    <H3>ArraySwap Example</H3>

    <CFSET month = ArrayNew(1)>
    <CFSET month[1] = "February">
    <CFSET month[2] = "January">
    <CFSET temp = ArraySwap(month, 1, 2)>
    <CFSET temp = ArrayToList(month)>

    <P>Show the results: <CFOUTPUT>#temp#</CFOUTPUT>

    </BODY>
    </HTML>