My Go Tutorial

Declare a variable (Part 1)

MUST declare before using it

Declaration Syntax

var variable_name type

var odometer int

Naming Rules (variable names and function names)

  • 1st letter
    • a-z (1st letter)
    • _ (underscore)
    • Unicode char
  • Style
    • CamelCase
  • Special Cases
    • public accessable by other Go packages
      • A-Z (lst letter capitalize)
  • No Go’s language syntax keywords

Note: If the above rule is not followed, IDE for Go will prompt for errors, and Go run compilation will fail.