How to make procedures triggered remotely I am installing lights in a model train and there are multiple prototypical lighting procedures that need to be activated. The lights are connected as follows:
Headlight Top - Pin 1
Headlight Bottom - Pin 2
Front Right Marker - Pin 3
Front Left Marker - Pin 4
Rear Right Marker - Pin 5
Rear Left Marker - Pin 6
Rear Left Headlight - Pin 7
Rear Right Headlight - Pin 8
Front Right Ditch Light - Pin 9
Front Left Ditch Light - Pin 10

I would like to simply address a forward procedure which would turn on pins 1, 2, 3, 4, 5, 6, 9, and 10. This is the lighting configuration when the loco is shifted into the forward gear. For reverse, pins 3, 4, 5, 6, 7, and 8 would be activated. There will be a few others too but those are the primary procedures. Is there a way I could set up a variable which names all those pins at once? Or is there some other way I could name a forwards or backwards lighting procedure with a single short name such as "Procedure 2"? I am using Arduino IDE.
perhaps an array and a loop? (dont have the Arduino IDE atm, so sorry about any typos)

int lights[] = {1, 2, 3, 4, 5, 9, 10};
int count = 7;//because there are 7 items in the array
//

main(){
    for (int i = 0; i &lt; count; i++){
         digitalWrite(lights[i], HIGH);
         delay(1000);
    }
}


EDIT: still no IDE, but here is a little more depth.

forward(true) = forward lights on

forward(false) = forward lights off

reverse(true) = reverse lights on

reverse(false) = reverse lights off

void forward(bool state){
    int lights[] = {1, 2, 3, 4, 5, 6, 9, 10};
    int count = sizeof(lights) / sizeof(lights[0]);

    for (int i = 0; i &lt; count; i++){
        switch (state){

            case true: //turn on
                digitalWrite(lights[i], HIGH);
                break;  

            case false: //turn off
                digitalWrite(lights[i], LOW);
                break;  
        }
        //delay(1000); //optional delay between lights?
    }                            
}

void reverse(bool state){
    int lights[] = {3, 4, 5, 6, 7, 8};
    int count = sizeof(lights) / sizeof(lights[0]);

    for (int i = 0; i &lt; count; i++){
        switch (state){

            case true: //turn on
                digitalWrite(lights[i], HIGH);
                break;  

            case false: //turn off
                digitalWrite(lights[i], LOW);
                break;  
        }
        //delay(1000); //optional delay between lights?
    }                            
}