if else if bug?

hi there, it seems the compiler is making something strange with this minimum working example code:

int hundreds;
short pixel;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

}

void loop() {
  
  hundreds = 0;
  if ((hundreds > 888) && (hundreds <= 0)) {
   pixel = 2;
 }else if ((hundreds > 111) && (hundreds <= 222)) {
   pixel = 3;
 }else if ((hundreds > 222) && (hundreds <= 333)) {
  pixel = 4;
 }else if ((hundreds > 333) && (hundreds <= 444)) {
   pixel = 5;
 }else if ((hundreds > 444) && (hundreds <= 555)) {
   pixel = 6;
 }else if ((hundreds > 555) && (hundreds <= 666)) {
   pixel = 7;
 }else if ((hundreds > 666) && (hundreds <= 777)) {
   pixel = 0;
 }else if ((hundreds > 777) && (hundreds <= 888)) {
   pixel = 1;
 } else {
   pixel = 8;
 }
 Serial.println(hundreds);
 Serial.println(pixel);
}

The code never goes into the first if statement and rather goes into the else which is basically wrong due to (hundreds > 888) && (hundreds <= 0) is true . Where is the problem here?

The expression “((hundreds > 888) && (hundreds <= 0))” is never true.

if ((hundreds > 888) && (hundreds <= 0))

How can it be > 888 and then <= 0 ?

Which Arduino do you have?

renedlog:
it seems the compiler is making something strange

While there is no guarantee that the compiler is perfect it is so much more likely that the error is in your code (or mine) that it is a complete waste of time wondering if the compiler is wrong.

...R

If there is a problem, always suspect your code, not the compiler.