A function to write several digital outputs at once (C++ level)

Just joining the different codes already posted:

// 8 LEDs are connected to pins 2 - 9
void setup() {
  // put your setup code here, to run once:
  for(int i=2; i<10;i++){
    pinMode(i, OUTPUT);
  }
}

// LEDS contains an 8-sequence pattern similar to https://www.youtube.com/watch?v=8lS-VvMhDus or to another side turn sequential leds

void loop() {
  // put your main code here, to run repeatedly:
  int LEDS[8] = {1,2,4,8,16,32,64, 128};
  
  for(int i=0; i<8;i++){
       emitPins(LEDS[i], 2,9);
       delay(1000);
  }
}

// Basic variant of the function
void emitPins(int val2emit, int pinIni, int pinFinal)
{
  int nPins = pinFinal - pinIni + 1;
  int pin2emit = pinIni;

  for(int i=0; i <nPins; i++){
  if(bitRead(val2emit, i) == 1)
    digitalWrite(pin2emit, HIGH);
  else
    digitalWrite(pin2emit, LOW);
  pin2emit ++;
  }

}