Support for environment adopting patterns similar to dynamic languages. For example, type inference (x := 0 is valid declaration of a variable x of type int)
Production of statically linked native binaries without external dependencies.
Comments
/* my first program in Go */
Requirements
Linux 20.04
Golang
Installation
sudo apt install golang-go
Run
go build hello.go
./hello
Notes:
To create variable: x int
To assign result of function variable: x := function()
The var statement declares a list of variables
Inside a function, the := short assignment statement can be used in place of a var declaration with implicit type.
When declaring a variable without specifying an explicit type (either by using the := syntax or var = expression syntax), the variable's type is inferred from the value on the right hand side. This is on 9 case at main of hello.go.
Constants are declared like variables, but with the const keyword.
Constants can be character, string, boolean, or numeric values.