Different languages allow very different things to evaluate to true and false. This is a guide / comparison of different languages.
evaluates to false | evaluates to true | |
---|---|---|
Perl | 0
empty string () undef | non-zero integer
"0E0" anything else |
Javascript [2] | false
null undefined 0 NaN empty string | true
empty list empty hash |
Python | False
None 0 of any type '', (), [], or {} | True
any other value |