Booleans
suggest changeValue of type bool
can be true
or false
.
Zero value of bool
is false
.
var b bool = true
fmt.Printf("b is: '%v'\n", b)
b = false
fmt.Printf("b is: '%v'\n", b)
var b2 bool
fmt.Printf("zero value of bool is: '%v'\n", b2)
b is: 'true'
b is: 'false'
zero value of bool is: 'false'
Size of bool
variable (e.g. when part of a struct) is 1 byte.
b := true
fmt.Printf("size of bool is: %d\n", unsafe.Sizeof(b))
size of bool is: 1
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents