Boolean types
A boolean type represents the set of Boolean truth values denoted by the predeclared constants
true
andfalse
. The predeclared boolean type isbool
; it is a defined type.
No real surprises here. Go supports Boolean types. You can use the pre-declared Boolean type bool
, or you can create your own types, backed by this type:
type SpanishBool bool
For an example why this might be useful, see my previous example.
Quotes from The Go Programming Language Specification, Version of January 19, 2023