3 ms·
(1) is a number. (not 0) is (false), a boolean. How could they be the same? They must be different because they are different types.
by Stratoscope 14y ago
(1) is a number. (not 0) is (false), a boolean. How could they be the same? They must be different because they are different types.
- vor_ 14y agoObviously there are reasons for the behavior, but it's still inconsistent to users who are exposed to your scripting API to have: if 1 then print "true" end if 1 == true then print "never prints" end Not a reason to avoid the language. But it may be a reason to consider an alternative with more conventional behavior.
- omaranto 14y agoIf you replace 1 with 2 this is an argument against using a vast number of languages, including Squirrel, I think. So maybe you're really saying that languages should forbid non-Boolean values in if statements. Maybe I agree with that.