LED Strip For Loop Delay

I'm trying to make a strip of addressable LEDs light up individually from the left, to right, then back left. After it completes, there is a significant delay. I tried adding a return after the second for loop but it didn't change anything. Can anyone help me figure out what is causing the delay? Thank you!

void loop() {


  for (int i = 0; i <= 27; i++) {
    leds[i] = CRGB(0, 255, 0);
    leds[i -1] = CRGB(0, 0, 0);
    FastLED.show();
    delay(100);
    }
    
    leds[27] = CRGB(0, 0, 0);
    FastLED.show();

  
  for (int i = 27; i <= 27; i--) {
    leds[i] = CRGB(0, 255, 0);
    leds[i +1] = CRGB(0, 0, 0);
    FastLED.show();
    delay(100);
    }

    return;
 
}

Why do you have a return statement in loop()?

for (int i = 27; i <= 27; i--)

Think about this line....

Regards,
Ray L.

aarg:
Why do you have a return statement in loop()?

Found that command while trying to figure it out. I tried to put that in there to start loop() over again and get rid of the delay. It did not work.

RayLivingston:

for (int i = 27; i <= 27; i--)

Think about this line....

Regards,
Ray L.

Ah ha! Thank you. Changed the <= but didn't change the 27 to 0! Thank you.