How to print boolean value in Go?

As we have %d for int. What is the format specifier for boolean values?


Solution 1:

If you use fmt package, you need %t format syntax. See package's reference for details.

Solution 2:

Use %t to format a boolean as true or false.