yq/pkg/yqlib/doc/Not Operator.md
2020-11-18 09:50:52 +11:00

950 B

This is a boolean operator and will return true when given a false value (including null), and false otherwise.

Examples

Not true is false

Running

yq eval --null-input 'true | not'

will output

false

Not false is true

Running

yq eval --null-input 'false | not'

will output

true

String values considered to be true

Running

yq eval --null-input '"cat" | not'

will output

false

Empty string value considered to be true

Running

yq eval --null-input '"" | not'

will output

false

Numbers are considered to be true

Running

yq eval --null-input '1 | not'

will output

false

Zero is considered to be true

Running

yq eval --null-input '0 | not'

will output

false

Null is considered to be false

Running

yq eval --null-input '~ | not'

will output

true