Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

for loop on values of array (no index)

package main

import "fmt"

func main() {
	dwarfs := [...]string{"Doc", "Grumpy", "Happy", "Sleepy", "Bashful", "Sneezy", "Dopey"}
	for _, name := range dwarfs {
		fmt.Println(name)
	}
}
Doc
Grumpy
Happy
Sleepy
Bashful
Sneezy
Dopey