Standard library / log/slog

slog.Value.Bool()

Return the represented Bool value; typed accessors require the appropriate Kind (String and Any have broader behavior). Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) Bool() bool

Return Value

bool

Return the represented Bool value; typed accessors require the appropriate Kind (String and Any have broader behavior).

Working Example

Example Snippetgo
package main
import (  "fmt"  "log/slog")
func main() { fmt.Println(slog.BoolValue(true).Bool()) }
Go Reference