ArraySet

Description

In a one-dimensional array, sets the elements in a specified range to a value. Useful in initializing an array after a call to ArrayNew.

Returns a Boolean TRUE on successful completion.

Category

Array functions

Syntax


ArraySet(array, start_pos, end_pos, value) 

See also

ArrayNew

Parameters

Parameter
Description
array
Name of an array to change.
start_pos
Starting position in array.
end_pos
Ending position in array. If this value exceeds the array length, elements are added to the array.
value
The value to add to the range of elements in 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)>

<!--- 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">

...



Banner.Novgorod.Ru