Re: IF statement, I don't understand this
- From: Howard Brazee <howard@xxxxxxxxxx>
- Date: Thu, 30 Mar 2006 09:13:07 -0700
On Thu, 30 Mar 2006 08:03:25 -0800, "Chuck Stevens"
<charles.stevens@xxxxxxxxxx> wrote:
Another mistaken assumption is that abbreviated combined relation conditions
somehow imply a different (and probably higher) precedence from that which
would occur in their fully-expanded counterparts -- that the fact that an
abbreviation occurs in 'ASM010-I-DIR = "L" OR "R" OR "S" ' somehow means
this gets evaluated as a unit (as it might in English). It doesn't. The
abbreviated conditions are treated as if they were expressed in their full
form, and the resulting full conditional expression is then evaluated.
Absent parentheses, it's AND before OR, and otherwise left to right.
Agreed. I never use them for that reason, and because I prefer
writing my conditions one per line (which makes commenting them easy).
e.g.
IF (SHH-SHIP-CODE = 5
AND ASM010-I-DIR = "L" )
OR ASM010-I-DIR = "R"
OR ASM010-I-DIR = "S"
or even
IF (
SHH-SHIP-CODE = 5
AND ASM010-I-DIR = "L"
)
OR ASM010-I-DIR = "R"
OR ASM010-I-DIR = "S"
With a compiler that accepts in-line comments, this method has another
advantage - we can say what "R" means!
.
- Follow-Ups:
- References:
- IF statement, I don't understand this
- From: Jack Benny
- Re: IF statement, I don't understand this
- From: Howard Brazee
- Re: IF statement, I don't understand this
- From: Chuck Stevens
- IF statement, I don't understand this
- Prev by Date: Re: IF statement, I don't understand this
- Next by Date: Re: IF statement, I don't understand this
- Previous by thread: Re: IF statement, I don't understand this
- Next by thread: Re: IF statement, I don't understand this
- Index(es):
Relevant Pages
|