HUGO
Menu
GitHub 87548 stars Mastodon

not

Returns the boolean negation of its single argument.

Syntax

not VALUE

Returns

bool

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

有關更多信息,請參閱 Go 的 text/template 文檔。


Last updated: January 1, 0001
Improve this page