Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Initializing the variable at declaration time:

var x int = 5

Quick Syntax: infers type based on value.

x:=5


Example:

Code Block
package main
  
import (
  "fmt"
)

func main(){
  var x int
  x = 5
  fmt.Println(x)
}

...