Task

Show how to represent the boolean states "true" and "false" in a language.

If other objects represent "true" or "false" in conditionals, note it.



Related tasks

   Logical operations


with javascript_semantics
for i=1 to 3 do
    integer c = (i==2),         -- fine
            d = (c==1),         -- oops
            e = (c==true),      -- fine
            f = equal(c,1)      -- fine, ditto equal(c,true)
    printf(1,"%d==2:%5t(%d) ==1:%5t, eq1:%5t, ==true:%5t\n",
              {i,     c, c,       d,       e,          f})
end for
--
-- output on desktop/Phix: 1==2:false(0) ==1:false, eq1:false, ==true:false
--                         2==2: true(1) ==1: true, eq1: true, ==true: true
--                         3==2:false(0) ==1:false, eq1:false, ==true:false
--
-- output on pwa/p2js:     1==2:false(0) ==1:false, eq1:false, ==true:false
--                         2==2: true(1) ==1:false, eq1: true, ==true: true
--                         3==2:false(0) ==1:false, eq1:false, ==true:false
--
