GoSliceappend

Appends elements to the end of a slice and returns the updated slice.

Syntax

append(s []T, elems ...T) []T

Example

Enter values below to update the example in real time.

append
fmt
Println
s := []int{1, 2, 3}
s = append(s, 4, 5)
fmt.Println(s) // [1 2 3 4 5]