summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions/go-template/not.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/functions/go-template/not.md')
-rw-r--r--docs/content/en/functions/go-template/not.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/content/en/functions/go-template/not.md b/docs/content/en/functions/go-template/not.md
new file mode 100644
index 000000000..4c7747c7b
--- /dev/null
+++ b/docs/content/en/functions/go-template/not.md
@@ -0,0 +1,35 @@
+---
+title: not
+description: Returns the boolean negation of its single argument.
+categories: []
+keywords: []
+action:
+ aliases: []
+ related:
+ - functions/go-template/and
+ - functions/go-template/or
+ returnType: bool
+ signatures: [not VALUE]
+---
+
+Unlike the `and` and `or` operators, the `not` operator always returns a boolean value.
+
+```go-html-template
+{{ 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:
+
+```go-html-template
+{{ 42 | not | not }} → true
+{{ "" | not | not }} → false
+```
+
+{{% include "functions/go-template/_common/text-template.md" %}}