LED Caterpillar

This is one of my first programs. Using Arduino Uno R3. I have pins 2 through 10 each attached to +ve end of a LED. the -ve end have a resistor which is also connected to ground. Idea is to get light to bounce back and forth. It looks pretty cool. I tried to make the code as compact as possible. Anyone see how I can make it more compact?

/*
  Light Caterpillar
  See light go back and forth along a string of LEDs.
  This example code is in the public domain.
  Written 29 Feb 2016, by SuBonr
*/
int firstPin=2;
int lastPin=10;
int next=1;
void setup() {
  for(int x=firstPin;x<lastPin+1;x++){
    pinMode(x, OUTPUT);
  }
}
void loop() {
  for(int x=firstPin;x<lastPin+1;x=x+next){
    digitalWrite(x,1);
    if (x==10||x==1){
      next=-next;
    }
    if (next>0){
      digitalWrite(x+1,1);
      digitalWrite(x-1,0);
    }
    else{
      digitalWrite(x+1,0);
      digitalWrite(x-1,1);
    }
    delay(20);
  }
}

Cheers,
SuBonr.

Research "Larson Scanner".