3000 explained code solutions for 75 technologies

golangHow to append value to array

func main() {
  var arr []string
  arr = append(arr, "a", "b")
  arr = append(arr, "c")
}ctrl + c
func main() {

declare main function that will be launched automatically

var arr []string

declare sample string slice


appends given value(s) to specified slice


slice to append values to

"a", "b"

you can append multiple values at once


or single value