LED Chaser Code For 4 LEDs

const int ledPins[] = {2, 3, 4, 5};

void setup() {
  // Set the LED pins as output
  for (int i = 0; i < 4; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
}

void loop() {
  // Loop through each LED
  for (int i = 0; i < 4; i++) {
    // Turn on the current LED
    digitalWrite(ledPins[i], HIGH);
    // Wait for 100ms
    delay(100);
    // Turn off the current LED
    digitalWrite(ledPins[i], LOW);
  }
}