The replace Statement
The replace statement replaces one or more items in a source array and stores the modified array contents in an output array. The array source argument (second) can be the same variable as the array destination (first) argument to replace without copying the array. The index of the element(s) to be replaced is specified via the third argument. The new value (last) argument can be an array, in which case multiple items are replaced. The syntax of the replace statement is shown below.
// replace arValues[idx] with x in arNew (arValues is unchanged)
replace arNew, arValues, idx, x