Problem running IF statement in void loop

Hello,
I have come across a problem using FastLED and Onebutton library.
I'm trying to set each LED, different hue value(which changes over each iteration(10 ms)) when button is pressed(Long click). Here is my code:

#include <FastLED.h>
#include <OneButton.h>


#define NUM_LEDS 34
#define LED_PIN 2
#define BTN_PIN 3
CRGB leds[NUM_LEDS];
OneButton button(BTN_PIN,true);
int LC =0;
uint8_t hue=0;
void setup() {
  FastLED.addLeds<WS2812B,LED_PIN,GRB>(leds,NUM_LEDS);
  FastLED.setBrightness(70);

  button.attachLongPressStop(longclick);
}

void loop() {
  if(LC==1){
    for (int i= 0; i<= NUM_LEDS;i++){
      leds[i]= CHSV(hue+(i*15), 255, 255);
      }
    EVERY_N_MILLISECONDS(10){
      hue++;
  }
    FastLED.show();
  }

  button.tick();
}
void longclick(){
  LC=1;
}

I have defined LC so when longclick is activated, the if statement turns true and causes the hue value to change. But when I press the button the if statement runs once and somehow it doesn't run afterwards. So I get LEDs with different hues; But hue values remain the same and I get same hue through different iteration for each LED.

I'm really new to c++ and arduino(started 30 hours ago). I have tried to search the solution of my problem. But sadly I couldn't find any solutions. I hope you can help me.
Thanks,

add a serial print to longclick() to see if it's being invoked when there is a button press.

what is "EVERY_N_MILLISECONDS()"?

You are going outside the bounds of the array (index goes from 0 to 33). You need to change the for loop to the following...

    for (int i= 0; i < NUM_LEDS;i++){

It's a macro defined in the FastLED library. It's used in a lot of their example sketches. It repeats the code following it on a given interval. Almost certainly uses millis()/blink without delay technique behind the scenes.

is EVERY_N_MILLESECONDS() blocking? a replacement for loop()?

do you mean it runs repeatedly or that it "exercises" the code every interval

I tried to look up the macro in the fastled-library
OMG it seems to be cascaded macros

#define EVERY_N_MILLISECONDS(N) EVERY_N_MILLIS(N)

#define EVERY_N_MILLIS(N) EVERY_N_MILLIS_I(CONCAT_MACRO(PER, __COUNTER__ ),N)

crazy stuff

Yes, that. It's not blocking.

It's clever. I suspect it boils down to each use of the macro creating a static unsigned long variable with either a unique name or the same name but a very localised scope, which gets compared with millis() to see if it's time to run the associated code lines.

thanks for digging into it

Thanks! That solved my problem