mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Merge commit '9b0050e9aabe4be65c78ccf292a348f309d50ccd' as 'docs'
``` git subtree add --prefix=docs/ https://github.com/gohugoio/hugoDocs.git master --squash ``` Closes #11925
This commit is contained in:
35
docs/content/en/functions/go-template/not.md
Normal file
35
docs/content/en/functions/go-template/not.md
Normal file
@@ -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" %}}
|
Reference in New Issue
Block a user