To print a boolean value in Go, you can use the fmt.Println() or fmt.Printf() functions.
Method 1: Using the fmt.Println() function
Here is an example of printing a boolean value using fmt.Println() function.
package main
import (
"fmt"
)
func main() {
isTrue := true
fmt.Println("The boolean value is:", isTrue)
}
Output
The boolean value is: true
Method 2: Using the fmt.Printf() function
You can also use the fmt.Printf() function with the %t verb, specifically used to format boolean values.
package main
import (
"fmt"
)
func main() {
isTrue := true
fmt.Printf("The boolean value is: %t\n", isTrue)
}
Output
The boolean value is: true
Remember to use %t as the format specifier for boolean values when using fmt.Printf() function.
That’s it.

Krunal Lathiya is a Software Engineer with over eight years of experience. He has developed a strong foundation in computer science principles and a passion for problem-solving. In addition, Krunal has excellent knowledge of Distributed and cloud computing and is an expert in Go Language.