Replace

Replaces all occurrences of a value in a slice with another value.


slices.Replace([]int{1, 9, 3}, 1, 2, 2)
                        
introduction.go