How append a slice to an existing slice in Golang?
The usage of triple-dot ... ellipsis used to append a slice.
Example
package main
import "fmt"
func main() {
var slice1 = []string{"india", "japan", "canada"}
var slice2 = []string{"australia", "russia"}
slice2 = append(slice2, slice1...)
}
Most Helpful This Week
How do you handle HTTP Client server load balancing in Go?
Pass an Interface as an argument to a function in Go (Golang)
Go program to find MX records record of a domain
Is There Still a Need for Programming in This AI World?
What is state in React?
Golang program for implementation of Binary Search