Categories
Go My Go Tutorial

Looping Over Arrays and Slices

package main

import "fmt"

func main() {
  names := []string{"Shank Kuo","Hoi Leng","Choi Yan","Evelyn Chan"}

  for i:=0; i < len(names); i++ {
    fmt.Println(names[i])
  }
}

https://repl.it/@shankuo/LoopArraySlice

go version go1.14 linux/amd64
 go run main.go
Shank Kuo
Hoi Leng
Choi Yan
Evelyn Chan