Please assist me in optimizing my (beginner) code

PaulS: i should change it to this?

int pushbutton_state[] = {};

Imahilus: thanks, i will get back to tomorrow :slight_smile:

Another question about this part:

}else{
          pushbutton_pressed = false; 
          BlinkM_setRGB(leds[i],0x00,0x00,0x00);
       }

How would i go about making sure that this else part in the loop only runs once? Do i need to do the same as above and use some kind of counter? I only want it run once because i want to implement midi note off there and its enough if it sends a noteoff once.

Same goes with the BlinkM_setRGB(leds*,0x00,0x00,0x00);*
statement, it turns my leds off (black) - but really i don't need it to keep on running forever do i?