arraySet

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

arraySet(array, start, end, value) → returns boolean

Member Function Syntax

someArray.set(start, end, value)

Argument Reference

array array
Required

start numeric
Required

end numeric
Required

value any
Required

Examples
Sample code invoking the arraySet function

<cfset MyNewArray = arrayNew(1)> 
<!--- ArrayToList does not function properly if the Array has not been initialized with arraySet. ---> 
<cfset temp = arraySet(MyNewArray, 1,6, "Initial Value")> 
<cfoutput>#ArrayToList(myNewArray,', ')#</cfoutput>

Expected Result: Initial Value, Initial Value, Initial Value, Initial Value, Initial Value, Initial Value

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub