Debian Codegraph @

docs/content/en/functions/go-template/not.md

raw
1 ---
2 title: not
3 description: Returns the boolean negation of its single argument.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: []
9 returnType: bool
10 signatures: [not VALUE]
11 ---
12
13 Unlike the `and` and `or` operators, the `not` operator always returns a boolean value.
14
15 ```go-html-template
16 {{ not true }} → false
17 {{ not false }} → true
18
19 {{ not 1 }} → false
20 {{ not 0 }} → true
21
22 {{ not "x" }} → false
23 {{ not "" }} → true
24 ```
25
26 Use the `not` operator, twice in succession, to cast any value to a boolean value. For example:
27
28 ```go-html-template
29 {{ 42 | not | not }} → true
30 {{ "" | not | not }} → false
31 ```
32
33 {{% include "/_common/functions/go-template/text-template.md" %}}