Control a servo with a ir sensor

and i was thinking if there is any way to instead of having
if(analogRead(analogInPin) > 600){
servo.write(i);
delay(3000); i could have something that only allow the code to continue if the analogRead(analogInPin) changes to a below or a higher number.

Well, of course there is. I just don't understand what you want to do. "Changes to below"? Below what? "or a higher number"? Higher than what?

analogInPin is a lousy name. Surely, you have not attached an analogIn to that pin. So, why doesn't the name reflect what is actually attached to the pin?

sensorValue is a lousy name, too. There is some specific kind of sensor attached. The name of the variable should reflect that.

Putting each { on a new line, and running Tools + Auto Format, will make your code a lot more readable.