not
Inverts the truthiness of the value, following the same rules as a template `if`: booleans by their value, numbers true when greater than zero, strings true when non-empty (except the literal 'false'), and collections true when non-empty.
nil and any unrecognized type are falsey, so Not returns true for them.
InputArgumentsReturns
Sourceanyno argumentsboolBasicSource
Inverts truthiness the same way a template `if` reads it, so a non-empty string is truthy and not makes it false.
Given
{"name": "Ada"}Template
{{ name | not }}Result
falseEmpty stringSource
Treats an empty string as falsey, so not reports it as true.
Given
{"name": ""}Template
{{ name | not }}Result
trueFalse stringSource
Treats the literal string "false" as falsey, matching how a template `if` reads it, so not returns true.
Given
{"flag": "false"}Template
{{ flag | not }}Result
trueZeroSource
Treats zero as falsey, so not reports it as true.
Given
{"count": 0}Template
{{ count | not }}Result
true