Category: Declarations

GO Programming Language Declarations

Declarations
Declarations are introduced by a keyword
var
const
type
func
and look reversed compared to C:
var i int
const PI = 22./7.
type Point struct { x, y int }
func sum(a, b int) int { return a + b }
Why are they reversed? Earlier example:
var p, q *int
Also functions read better and are consistent with other declarations.
Var
Variable declarations are introduced by var.
They [...]