Go code
var count int = 3
fmt.Println(count)Line-by-line explanation
- Count is declared as int.
- The whole number 3 is stored.
- Println displays it.
Expected output
3No decimal point appears because this is a whole number.
Go code
var temperature float64 = 21.5
fmt.Println(temperature)Line-by-line explanation
- Temperature is declared as float64.
- The decimal value is stored.
- Println displays it.
Expected output
21.5The decimal part remains visible.
Go code
var message string = "Hello"
fmt.Println(message)Line-by-line explanation
- Message is declared as string.
- Hello is stored as text.
- Println displays it.
Expected output
HelloQuote marks mark the source-code string but are not printed.
Go code
var ready bool = true
fmt.Println(ready)Line-by-line explanation
- Ready is declared as bool.
- Lowercase true is stored.
- Println displays it.
Expected output
trueGo boolean words are lowercase.