× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The NOT is performed before the other operations if there are no parens.

>From the Reference Manual here is the operator precedence:

()
Built-in functions, user-defined functions
unary +, unary -, NOT
**
*, /
binary +, binary -
=, <>, >, >=, <, <=
AND
OR

This means that in the following expressino the NOT is applied against *IN99
before doing the AND operations.
              if           NOT *IN99 and *IN98 and *IN97

It is my preference to use parens to always indicate the grouping I want to
occur.  This makes it easier to code and to read because a person doesn't
have to stop and think about the precedence rules.  This becomes more
important the more complex an expression becomes.

Scott Mildenberger



> -----Original Message-----
> From: Richard B Baird [mailto:rbaird@esourceconsulting.com]
> Sent: Monday, December 02, 2002 1:26 PM
> To: rpg400-l@midrange.com
> Subject: RE: notted boolean expressions (was: output specs and
> indicators)
>
>
>
> Bob,
>
> Bob said:
> > The caveat is that the NOT'ed indies need to either be put
> into parens,
> > placed at the end of the expression.
> > eg.
> >              if           (NOT *IN99) and *IN98 and *IN97
>
> Is that right?   are you saying that without the (), the not
> applies to all
> of the boolean expressions in the if statement?
>
> I have a working piece of code that goes as follows:
>
>   if        (not Dwildcard           and
>                  hrmDir <> *blanks   and
>                  hrmDir <> ListName)
> ..do something..
>   end
>
> notice, the 'not' on the boolean (n) variable, combined with compares
> (which resolve to a boolean yes or no, correct?)  if I get
> what you are
> saying, then what the above really means is:
>
>   if         not (Dwildcard and hrmDir <> *blanks and hrmDir
> <> ListName)
> ?
>
> and how about this?
>
>     if        not Fwildcard   and
>               not Dwildcard
> .. do something...
>     end
>
> if the beginning 'not' applies to all the boolean expressions in the
> statement, does it reverse the second 'not'?  or does it mean:
>
>     if        not (Fwildcard and not Dwildcard)
> ?
>
> until just now, I didn't think this was such a hard concept
> to understand.
> now i'm so confused.... ;)
>


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.