IF statement

Hello,
I build a tracing device using Arduino Mega .
The tracing switches on when the outside temperature is below 0°C .
I use a DS18B20 to measure the outside temperature .
Because , when I put on the lights in my garage where the Mega is mounted, the temperature goes to -127 for a moment I want to change the softwarif (sensors.getTempCByIndex(0) < 0){ /
merker4=true;
lcd.setCursor(4,1);
lcd.print("1");e from:

to:

if (sensors.getTempCByIndex(0) <0 && sensors.getTempCByIndex(0) > -30){
merker4=true;
lcd.setCursor(4,1);
lcd.print("1");

This does not seem to work .
Can anyone tell me why this does not work ?
Th intention is that only when the temperature is between 0 and -30°C merker 4 becomes true .
Regards and many thanks .

Jan

Get the temperature once and compare twice.

THX for quick answer .

Jan

This does not seem to work .

Sure it does. It worked just fine. It is obviously your expectations that are wrong.

Like expecting help based on snippets.
Like expecting help without describing what the code actually does.
Like expecting help without describing what you expect it to do.