4 ms·
> Python's rule is simple, it's JS that came up with confusing rules. I think Perl was there first: in addition to 0 and "" being falsy in Perl, "0" is also fa
by hibbelig 7y ago
> Python's rule is simple, it's JS that came up with confusing rules.
I think Perl was there first: in addition to 0 and "" being falsy in Perl, "0" is also falsy. Then there is this nifty Perl value "0 but true": if you stick it into a condition, it will evaluate to true, but if you do math with it, it behaves like the number zero.