home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 262,298 of 264,096   
   Chris Townley to Dave Froble   
   Re: basic BASIC question   
   31 Jan 25 16:56:27   
   
   From: news@cct-net.co.uk   
      
   On 31/01/2025 16:39, Dave Froble wrote:   
   > On 1/31/2025 10:18 AM, Arne Vajhøj wrote:   
   >> Is it common to use:   
   >>   
   >> declare integer constant TRUE = -1   
   >> declare integer constant FALSE = 0   
   >>   
   >>   
   >> ?   
   >>   
   >> Arne   
   >>   
   >   
   > It works.  Doesn't really matter if declared a constant.  Zero is false,   
   > anything else is true.  Using 1 vs -1 has been more my experience.   
   >   
   > Perhaps the concept of true and false isn't as clear in Basic as in some   
   > languages.   
   >   
      
   I am surprised that 1 works if you using it on the result of a logical   
   operation - it is documented:   
      
   EXPRESSIONS   
      
      Truth_values   
      
         In relational expressions, BASIC generates -1 when the relationship   
         is true  and  0  when it is false.  In logical expressions, BASIC   
         evaluates any nonzero value as true; zero is always evaluated as   
         false.  To  avoid unanticipated   results,   use  logical operators   
         on  the  results  of relational expressions.   
      
      
   --   
   Chris   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca