Forum rules - please read before posting, it can save you a lot of time.
while (actor.X > startX && actor.X < endX){ code to execute}