#include <Arduino.h>

// Five LEDs on consecutive D8-D12; changing pin layout requires editing loop range.

void setup() {
  // for means: start pin at 8, repeat through 12, and add 1 each time. This replaces five
  // repeated statements.
  for (int pin = 8; pin <= 12; pin++) {
    // Every pass configures the next consecutive pin as an output.
    pinMode(pin, OUTPUT);
  }
}

void loop() {
  // Run the same LED sequence over D8, D9, D10, D11 and D12.
  for (int pin = 8; pin <= 12; pin++) {
    // pin changes each pass, so the same instruction lights a different LED.
    digitalWrite(pin, HIGH);
    delay(300);
    // Turn the current LED off before the loop moves to the next pin.
    digitalWrite(pin, LOW);
  }
}
