We started from the next slide: https://go.dev/tour/basics/8
- In go
var
statement declares a list of variables and we can define the type in the last.
var
declaration can include initializers, one per variable. And the type can be omitted.
- Inside a func
:=
short assignment statement can be used in place of a var declaration with implicit type.
- We learnt about all the Go's basic types and The
int
,uint
, anduintptr
types are usually 32 bits wide on 32-bit systems and 64 bits wide on 64-bit systems. Remember by default it comes with 32 bits and then it gets changed as per your system.
- In GO variables declared without an explicit initial value are given their zero value.
- The expression
T(v)
converts the valuev
to the typeT
.
- In GO while declaring the variable's type is inferred from the value on the right hand side.
Please refer to the examples given in the slide for better understanding.
- For this session we ended it here - https://go.dev/tour/basics/14