Section 1 of 11

Functions & syntax

Types come after names. No void. Multiple return values.

Go moves every type to the right of the thing it describes. That single rule accounts for most of why Go looks alien to a Java reader.

anatomy
func   add   (a, b int)    int
 |      |        |          |
 |      |        |          +-- return type, AFTER the parens
 |      |        +-- params: NAME first, TYPE second
 |      +-- function name
 +-- keyword, always

Functions, multiple returns, zero values

go.dev playground

Try it: Try removing the `_ =` on the last line — unused variables are a compile error, not a warning.