NetLogo Help: replace-item

### replace-item1.0

#### replace-item index list value replace-item index string1 string2

On a list, replaces an item in that list. index is the index of the item to be replaced, starting with 0. (The 6th item in a list would have an index of 5.) Note that "replace-item" is used in conjunction with "set" to change a list.

Likewise for a string, but the given character of string1 removed and the contents of string2 spliced in instead.

If index is fractional, it will be rounded down to the nearest integer (4.5 becomes 4, 10.9 becomes 10).

    show replace-item 2 [2 7 4 5] 15
    => [2 7 15 5]
    show replace-item 1 "cat" "are"
    => "caret"

Take me to the full NetLogo Dictionary