2948 explained code solutions for 75 technologies


golangHow to create slice with values


package main
 
func main() {
  arr := [3]int{3,6,8}
  print(arr[1])
}ctrl + c
package main

default package declaration

func main() {

declare main function that will be launched automatically

[3]int{3,6,8}

create slice of 3 elements of int type with given values