1. questionable logic

Hey everyone!
I read this pseudocode in a design book, and I found it bothersome, tell me if this is a good way to program, or if it's better to state the exact conditions of if statement execution:

The table we're working with is:
A = 90-100
B = 80-89
C = 70-79

Code:
```IF percentage > 89 THEN
ELSE
IF  percentage > 79 THEN
ELSE
IF percentage > 69 THEN
ENDIF
ENDIF
ENDIF```
This is probably just style, but wouldnt it be a better idea to just explicitly state in your code what the exact parameters are? And BTW, I understand this would be written with ELSE IF's...the whitespace used was just taken form the book,

i.e.
Code:
```IF percentage > 89 AND percentage <= 100 THEN
etc...```
I was just wondering, thanks for the help -Chap

2. I dont see whats wrong with it..

Well everything above 100% is still an A right? lol

3. Using your example would involve a lot of unnecessary comparisons, the results of which can be inferred based on previous results. For example after the first ELSE, it is safe to assume that the grade is NOT greater than 89, so why test to see if it's less than or equal to?

4. I agree with sean. What he's implying is that readability is not significantly improved by explicitly stating the ranges, while performance takes quite a hit.

One change I would suggest, though, is to make it >= 90 and >= 80 and >= 70 rather than > 89 etc... the effect should be the same, but I personally think it's more clear using the >=.

5. but I personally think it's more clear
Not to mention the possibility of an 89.1 if you're using floating-point variables.

6. Err, right. I assumed it would be working exclusively with integers though, given the pseudocode and the grade table. If working with floating point numbers, then using the grade table provided, explicit comparisons (x <= 100 && x >= 90, x <= 89 && x >= 80, etc.) would actually be required. That's just being pedantic though

7. hahaha, very good points have been brought up and I'm very glad I asked that question. Thanks (yet again) for all the help. Cheers, Chap

8. As pseudo code I cant see anything wrong with it. But were you thinking in terms of the actually coding and did you mean something like this (more readable and easier to edit):

Code:
```const int gradeA = 80;