18. Go - fmt Scan Inputs
fmt.Scanln(&Variablename)
// waits for input and gives the variable the input
// does not consider whitespaces. only scans the first word that is before any whitespace
fmt.Scanf()
var a string
var b int64
var c float32
var d bool
fmt.Scanf("%s %d %g %t", &a, &b, &c, &d)
fmt.Println(a, b, c, d)
// lets us format the scan. each whitespace in the input will be set to each variable separated in the format.
Comments
Post a Comment