[go/en]: Clarify comment related to the append function in slices. (#4780)

This commit is contained in:
Ricardo Islas Ruiz 2024-02-25 14:46:12 -07:00 committed by GitHub
parent ebd63d9299
commit 16fa336a43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -130,7 +130,7 @@ can include line breaks.` // Same string type.
// Because they are dynamic, slices can be appended to on-demand. // Because they are dynamic, slices can be appended to on-demand.
// To append elements to a slice, the built-in append() function is used. // To append elements to a slice, the built-in append() function is used.
// First argument is a slice to which we are appending. Commonly, // First argument is a slice to which we are appending. Commonly,
// the array variable is updated in place, as in example below. // the slice variable is updated in place, as in example below.
s := []int{1, 2, 3} // Result is a slice of length 3. s := []int{1, 2, 3} // Result is a slice of length 3.
s = append(s, 4, 5, 6) // Added 3 elements. Slice now has length of 6. s = append(s, 4, 5, 6) // Added 3 elements. Slice now has length of 6.
fmt.Println(s) // Updated slice is now [1 2 3 4 5 6] fmt.Println(s) // Updated slice is now [1 2 3 4 5 6]