or
Returns the first truthy argument. If all arguments are falsy, returns the last argument.
Syntax
or VALUE...
Returns
any
The falsy values are false, 0, any nil pointer or interface value, any array, slice, map, or string of length zero, and zero time.Time values.
Everything else is truthy.
{{ or 0 1 2 }} → 1
{{ or false "a" 1 }} → a
{{ or 0 true "a" }} → true
{{ or false "" 0 }} → 0
{{ or 0 "" false }} → falseSee Go’s text/template documentation for more information.
Last updated:
March 5, 2025
:
content: Remove "related" array from function and method pages (2fcd21ee5)
Improve this page