Boolean values: Difference between revisions
m
→{{header|Phix}}: subtly reduced the implication of either defending Phix or accusing JavaScript (or vice versa).
m (C# Removed the remark about C#8 nullable types because it does not apply to bool.) |
m (→{{header|Phix}}: subtly reduced the implication of either defending Phix or accusing JavaScript (or vice versa).) |
||
Line 1,975:
The builtin constants TRUE/FALSE and their aliases True/true/False/false may also be used.
There is however a gotcha in JavaScript, and hence pwa/p2js, in that <b>true !== 1</b> and <b>false !== 0</b>. In almost all other respects, true is 1 and false is 0, for instance 1+true evaluates to 2, just like desktop/Phix. It is only direct comparison for equality of booleans and numbers using an infix operator which fails, and I suppose you could argue that is a programming logic blunder,
The following example illustrates, and also emphasies the subtlety of the issue (no difference whatsoever if c, d, e, f are defined as bool):
|