In an one-dimensional array, sets the elements in a specified index range to a value.
Useful for initializing an array after a call to ArrayNew.
array.set( start_pos=number, end_pos=number, value=any )
Returns: Array
Argument |
Description |
start_pos
number,
required
|
Starting index position of range to set.
Alias: start, startPos
|
end_pos
number,
required
|
Ending index position of range to set. If this value is greater than array length, Lucee adds elements to array.
Alias: end, endPos
|
value
any,
required
|
Value to which to set each element in the range.
|
Examples
myarray = [];
res = myarray.set(1,4,"all is well");
writeDump(res);
See also