Loop problem

I am trying to make a loop increase and decrease between two values, 12 and 80

void loop()
{
    int x = 1;
   for (int i = 12; i > -1; i = i + x){
      //Serial.println(i);
      myservo.write(i);
      if (i == 80) x = -1;  
      delay(100);
   }


}

I cannot understand why the value of i falls back to zero. Can someone please show me how to correct this problem and why, thanks

I cannot understand why the value of i falls back to zero.

Because zero is greater than minus one.

When you change the count direction, change to loop limit also.

Many thanks AWOL.