Functions continued
When consecutive parameters share a type, you can drop the type from all but the last. It’s a small shortcut, but you’ll see it often.
Here we shortened:
x int, y int
to:
x, y int When consecutive parameters share a type, you can drop the type from all but the last. It’s a small shortcut, but you’ll see it often.
Here we shortened:
x int, y int
to:
x, y int package main
import "fmt"
func add(x, y int) int {
return x + y
}
func main() {
fmt.Println(add(42, 13))
} ← → Use arrow keys to navigate