Boolean Data Type
Use the bool keyword when a variable only ever needs to answer yes or no. Just two values exist for this type: true and false.
A boolean that you declare but never assign starts out as false.
Example
The four variables below are declared in different ways. Notice that b3 has no starting value, so it prints false:
Prompt
Declare boolean variables in four ways: typed with value, untyped with value, typed without value, and short declaration. Print all four.
Output: Go program and captured output
main.go
package main
import ("fmt")
func main() {
var b1 bool = true // typed declaration with initial value
var b2 = true // untyped declaration with initial value
var b3 bool // typed declaration without initial value
b4 := true // untyped declaration with initial value
fmt.Println(b1)
fmt.Println(b2)
fmt.Println(b3)
fmt.Println(b4)
}