Standard library / text/template
text/template.IsTrue()
Reports template conditional truth and whether the value has a defined truth interpretation. Expected stdout: 'false true\n'.
Formal Syntax & Structure
go syntaxgo
func IsTrue(val any) (truth, ok bool)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| val | any | Value whose template truth is tested. |
Return Value
(truth, ok bool)
Reports template conditional truth and whether the value has a defined truth interpretation.
Working Example
Example Snippetgo
package main
import ( "fmt" "text/template")
func main() { v, ok := template.IsTrue([]int{}); fmt.Println(v, ok) }