As we have %d
for int. What is the format specifier for boolean values?
If you use fmt
package, you need %t
format syntax. See package's reference for details.
Use %t
to format a boolean as true
or false
.
%t
is the answer for you.
package main
import "fmt"
func main() {
s := true
fmt.Printf("%t", s)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With