9951 explained code solutions for 126 technologies


golangHow to create slice with one element


package main
 
func main() {
  arr := [1]string{"hello"}
}ctrl + c
package main

default package declaration

func main() {

declare main function that will be launched automatically

[1]string{

create slice of 1 element of string type