How to print variables

Printing

  • Print the same outputs
fmt.Printf("Hello %d\n", 23)
fmt.Fprint(os.Stdout, "Hello ", 23, "\n")
fmt.Println("Hello", 23)
fmt.Println(fmt.Sprint("Hello ", 23))
  • Mostly
    • %d: digit
    • %s: string
    • %v: all values (powerful)
    • %T: the type of the value