how to give discrete values in case switch

Hello, i know that we cant give discrete values in case - switch it needs to be a spesific value but im using infrared Sharp GP2Y0D805Z0F sensor and it always gives different values i mean when i measure 20 cm i reading analog values to between 265-275 so changable. So rather than using if command how can i using it with Case - Switch.

‘’
val = analogRead(sensorpin);
Serial.println(val);
delay(400);
if ((val > 265) && (val < 275))

‘’

So i need to write this with case-switch commands.

You can use switch/case like this

switch (val)
{
  case 265 ... 275:
    //do stuff
  break;
}

thanks a lot mate! Really appreciated your help.