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

At least one new variable on the left side of :=

  • The existing variable must receive a value of the same type it had earlier.
package main

import "fmt"

func main() {
	a, b := 1, 2
	fmt.Println(a, b)
	a, c := 3, 4
	fmt.Println(a, b, c)

}
1 2
3 2 4