hugo/docs/content/en/functions/go-template/not.md
Bjørn Erik Pedersen 5fd1e74903
Merge commit '9b0050e9aabe4be65c78ccf292a348f309d50ccd' as 'docs'
```
git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash
```

Closes #11925
2024-01-27 10:48:57 +01:00

758 B

title description categories keywords action
not Returns the boolean negation of its single argument.
aliases related returnType signatures
functions/go-template/and
functions/go-template/or
bool
not VALUE

Unlike the and and or operators, the not operator always returns a boolean value.

{{ not true }} → false
{{ not false }} → true

{{ not 1 }} → false
{{ not 0 }} → true

{{ not "x" }} → false
{{ not "" }} → true

Use the not operator, twice in succession, to cast any value to a boolean value. For example:

{{ 42 | not | not }} → true
{{ "" | not | not }} → false

{{% include "functions/go-template/_common/text-template.md" %}}