From: arne@vajhoej.dk   
      
   On 1/31/2025 1:35 PM, Arne Vajhøj wrote:   
   > On 1/31/2025 1:28 PM, Simon Clubley wrote:   
   >> On 2025-01-31, Arne Vajhøj wrote:   
   >>> Is it common to use:   
   >>>   
   >>> declare integer constant TRUE = -1   
   >>> declare integer constant FALSE = 0   
   >>   
   >> Oh goody. The "good" old days, when TRUE did not equal TRUE, are   
   >> back. :-)   
   >   
   > Some old some new.   
   >   
   > C and VMS Basic are old.   
   >   
   > But some newer script languages also have a   
   > "flexible approach" to true/false.   
   >   
   > $ type bool.php   
   >    
   > function test($expr) {   
   > echo ($expr ? 'true' : 'false') . "\r\n";   
   > }   
   >   
   > test(true);   
   > test(false);   
   > test(1);   
   > test(0);   
   > test(-1);   
   > test("X");   
   > test("");   
   > test(null);   
   >   
   > ?>   
   > $ php bool.php   
   > true   
   > false   
   > true   
   > false   
   > true   
   > true   
   > false   
   > false   
      
   $ type bool.py   
   def test(expr):   
    print("true" if expr else "false")   
      
   test(True)   
   test(False)   
   test(1)   
   test(0)   
   test(-1)   
   test("X")   
   test("")   
   test(None)   
   $ python bool.py   
   true   
   false   
   true   
   false   
   true   
   true   
   false   
   false   
      
   Arne   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|