"until" programming question

so here is my code, im sure it could be made much cleaner but im not to great with the programming side of things so i kind of just pieced together various examples. I dont have any of the hardware yet so I cant test if it will work. (ie I don't know if it will turn a fan on when the value gets over 600 and off when it is below 580) so if someone could let me know if this seems right that would be great. as for the rest of the code I feel like there must be a better way to write it and I want to fit it onto an ATtiny24 and i might want to add some more so it would be nice if it could be written more efficiently.

int counter = 3;
int up = 9;
int down = 10;
int LEDR = 8;
int LEDB = 7;
int LEDG = 6;
int sensPin = A2;
int relayPin = 5;
int tempPin = A3;

void setup()
{
  pinMode(sensPin, INPUT);
  pinMode(up, INPUT);
  pinMode(down, INPUT);
  pinMode(LEDR, OUTPUT);
  pinMode(LEDG, OUTPUT);
  pinMode(LEDB, OUTPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(tempPin, INPUT);
}

void loop() {
  int val = analogRead(tempPin); 
  //this makes sure the system only runs if it is above freezing
  if(val > 260){
  int upval = digitalRead(up);
  //there will be a SPDT momentary toggle switch 
  //which will scroll through the different temperature options 
  int downval = digitalRead(down);
  if(upval == HIGH)
  {
    delay(200);  
    counter ++;
  if(downval == HIGH)
   {
   delay(200);
   counter --;
   }  
    if(counter == 6)
    {
      counter = 1;
    }
  }

  else
    switch (counter) {
    case 1:
      {analogWrite(LEDR, LOW);
      analogWrite(LEDB, HIGH);
      analogWrite(LEDG, LOW);
      int val = analogRead(sensPin);
      if(val > 600) 
      {
      digitalWrite(relayPin, HIGH);
      }
      else if(val < 580);
      {
      digitalWrite(relayPin, LOW);
      }
      delay(100);
      break;}
    case 2:
      {analogWrite(LEDR, LOW);
      analogWrite(LEDG, 75);
      analogWrite(LEDB, HIGH);
      int val = analogRead(sensPin);
      if(val > 560) 
      {
      digitalWrite(relayPin, HIGH);
      }    
      else if(val < 540)
      {
      digitalWrite(relayPin,LOW);
      }
      delay(100);
      break;}
    case 3:
      {analogWrite(LEDR, LOW);
      analogWrite(LEDG, HIGH);
      analogWrite(LEDB, LOW);
      int val = analogRead(sensPin);
      if(val > 500) 
      {
      digitalWrite(relayPin, HIGH);
      }
      else if(val < 480);
      {
      digitalWrite(relayPin,LOW);
      }
      delay(100);
      break;}
    case 4:
      {analogWrite(LEDR, 75);
       analogWrite(LEDB, 75);
       analogWrite(LEDG, HIGH);
       int val = analogRead(sensPin);
       if(val > 470) 
       {
       digitalWrite(relayPin, HIGH);
       }
       else if(val < 450); 
       {
       digitalWrite(relayPin,LOW);
       }
       delay(100);
       break;}
    case 5:
      {analogWrite(LEDR, HIGH);
       analogWrite(LEDB, LOW);
       analogWrite(LEDG, LOW);
       int val = analogRead(sensPin);
       if(val > 440) 
       {
       digitalWrite(relayPin, HIGH);
       }
       else if(val < 420);
       {
       digitalWrite(relayPin,LOW);
       }
       delay(100);
       break;}
       
    }
  } 
 else{ 
 digitalWrite(relayPin, LOW);
 digitalWrite(LEDR, LOW);
 digitalWrite(LEDG, LOW); 
 digitalWrite(LEDB, 75);
 delay(300);
 digitalWrite(LEDB, LOW);
 delay(2000);
 
 }
}