Simple Pendulum Mouvement

Hi Here,
this is my first post. I try to find an issue alone, checking online but without success
I am making my first arduino project and got a problem
I guess it is a very simple code but i should make something wrong because it doesn't work
i got a servomotor and want to generate a pendulum mouvement with it.
For a reason i don't understand, the servo makes a rest at the end of the cycle...
It goes... and comes ...and wait before going again
Anyone sees what's wrong ???
Any feedback appreciated !
thx

#include <Servo.h>

Servo myservo;
int pos;
int angleInit;
int angleMax;
int angleMin;

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
angleInit = 12;
myservo.write(angleInit);
delay(1000);
angleMax = angleInit+3;
angleMin = angleMax-6;
myservo.write(angleMax);
}

void loop()
{

for(pos = angleMin; pos < angleMax; pos += 1)
myservo.write(pos);
delay(100);
}
for(pos = angleMax; pos > angleMin; pos -= 1)
{
myservo.write(pos);
delay(100);
}
}

It doesn't compile, so it's hard to say. Your braces don't match - are the two for loops actually the same with respect to whether the delay is inside them?

ok i found it
that's because at some point pos value became negative so the servo stayed at 0.
Thanks for the answer

I would not use a FOR loop. I would just use loop() - something like this

void loop() {
   servo.write(angle);
   delay(100);
   angle = angle + change;
   if (angle <= angleMin || angle >= angleMax) {
      change = - change;
   }
}

...R