[futurebasic] Re: [FB] Embeded LONG IFs

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: Paul Bruneau <paul_bruneau@...>
Date: Tue, 19 Oct 1999 09:10:00 -0400
I'll beat the horse some more. Yes, you can use parentheses if you want
to, but they are by no means necessary as long as you stay away from the
"implied" stuff like this:

LONG IF myVar%                               'This would be OK

LONG IF myVar% = 4                           'This would be OK

LONG IF myVar% = 4 and myOtherVar% = 5       'Even this is OK

LONG IF myVar% and myOtherVar% = 5           'Here is the bad stuff!!!

This results in trouble unless you are super familiar with how the
compiler "thinks" of this code.

Does it see: LONG IF (myVar% and myOtherVar%) = 5

Or does it see LONG IF (myVar%) and (myOtherVar% = 5) ??

I just write it as  LONG IF myVar% = 4 AND myOtherVar% = 5

As long as you have a comparator (right term??) for every part, I find
parens are unnecessary.

Michael Evans wrote:
> 
> Sylvain:
> 
> I have found when using "AND" with a LONG IF it is very important to use
> parentheses:
> 
> > LONG IF (<this>) AND (<that>) AND (<the other thing>) AND (<etc.>)
> >   <stuff that gets done if it's all true>
> > END IF