Servo Sweep with conditions

ok i added the auto format and the }. The problem is when the sensor is lower than 400 is making the servo act like the IF but it should be Else (lower than 400) .. from 0 to 180 degree step by step, returning to 0 fast and going to 0 to 180 degree step by step again and again.

Serial says this and its fine because is not in the soil (making the condition Else < 400 BUT acting like the IF)
Moisture Sensor Value: 0
Moisture Sensor Value: 0
Moisture Sensor Value: 7
Moisture Sensor Value: 7
Moisture Sensor Value: 11
Moisture Sensor Value: 7
Moisture Sensor Value: 0

//OB SOIL 
//# the sensor value description
//  # 0  ~300      dry soil
//  # 300~700     humid soil
//  # 700~950     in water
#include <Servo.h>
Servo myservo;
const int number = 400;
int pos = 0;

void setup()
 {
  Serial.begin(9600);
  myservo.attach(9);
 }

void loop()
{
  Serial.print("Moisture Sensor Value:");
  Serial.println(analogRead(2));  
  delay(100); 
  if (analogRead(2) > number) 
  {
    for(pos = 0; pos < 180; pos += 1)  
    {                                   
      myservo.write(pos);              
      delay(15);                       
    }
  } 
  else 
  {
    for(pos = 180; pos>=1; pos-=1)     
    {                                
      myservo.write(pos);               
      delay(15);                        
    } 
  }
}