Standard library / strconv

strconv.FormatBool()

Returns either true or false as lowercase text. Expected stdout: 'false\n'.

Formal Syntax & Structure

go syntaxgo
func FormatBool(b bool) string

Parameters & Attributes

NameTypeDescription
bboolBoolean value to encode.

Return Value

string

Encoded representation.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strconv")
func main() {  fmt.Println(strconv.FormatBool(false))}
Go Reference