David in Canada

 

Tech, life, and everything in between.

Day 2 of Learning Go: Variables, Types, and CLI Input

Updated at # Tech # Go

Today’s knowelege is quite simple:

Key Concepts

variable

  1. Use var to declare a variable

  2. use

    var a int = 30

    to declear a as a integer type, or just use := like:

    a := 100

    to let Go infer the type automatically

Data Type

basic data types:

Cli Input

use fmt.Printf() to format output, common format verbs: