Every value in Go has a type. The type tells Go what kind of data the value represents.
Common Go types include:
intfor whole numbers, like5float64for decimal numbers, like3.14stringfor text, like"Hello"boolfor truth values,trueorfalse
var age int = 31
var price float64 = 9.99
var name string = "Andy"
var isStudent bool = true
Assignment
Follow the Coding Tutorial and create variables of different Go types.
Hint
Write the type after the variable name when using var.
Free plan: 30 tutor messages. Premium is unlimited.
Saved
Ctrl + Enter to check
