user28812: Is it possible to read a digital input from an array without using the exact element? Such as 
   while(digitalRead(myButtonArray[i]))
     digitalWrite(myLEDArray[i], HIGH);

Reading the myButtonArray one by one and turning on the led one by one doesnt make for clean written code. The following is just an example code. When button on pin 2 which is element 0 is pressed turn on led on pin 7 and turn off when released. When button on pin 3 is pressede turn on led on pin 8 and turn off when released and continue on in the same fashion with the rest of the buttons and leds as well.
 int myButtonArray[] = {2,3,4,5,6};
 int myLEDArray[] = {7,8,9,10,11};

 void setup() {
   for(int i = 0;i<5;i++){
     pinMode(myButtonArray[i], INPUT);
     pinMode(myLEDArray[i], OUTPUT);
   }

 }

 void loop() {
 while(digitalRead(myButtonArray[0]))
      digitalWrite(myLEDArray[0], HIGH);

 while(digitalRead(myButtonArray[1]))
      digitalWrite(myLEDArray[1], HIGH);

 while(digitalRead(myButtonArray[2]))
      digitalWrite(myLEDArray[2], HIGH);

 while(digitalRead(myButtonArray[3]))
      digitalWrite(myLEDArray[3], HIGH);

 while(digitalRead(myButtonArray[4]))
      digitalWrite(myLEDArray[4], HIGH);     
 }


user15180: I think, you did not realized, that digitalWrite(i,value) sets the pin i to value AND the pin have the value until set otherwise. So you probabelly want something like this:
void loop() {
  for (int i=0;i<5;i++) 
    digitalWrite(myLEDArray[i], digitalRead(myButtonArray[i]));
}

where each LED follows each respective Button both HIGH and LOW.

28812: <p>Is it possible to read a digital input from an array without using the exact element? Such as </p>

<pre><code>   while(digitalRead(myButtonArray[i]))
     digitalWrite(myLEDArray[i], HIGH);
</code></pre>

<p>Reading the myButtonArray one by one and turning on the led one by one doesnt make for clean written code. The following is just an example code. When button on pin 2 which is element 0 is pressed turn on led on pin 7 and turn off when released. When button on pin 3 is pressede turn on led on pin 8 and turn off when released and continue on in the same fashion with the rest of the buttons and leds as well.</p>

<pre><code> int myButtonArray[] = {2,3,4,5,6};
 int myLEDArray[] = {7,8,9,10,11};

 void setup() {
   for(int i = 0;i&lt;5;i++){
     pinMode(myButtonArray[i], INPUT);
     pinMode(myLEDArray[i], OUTPUT);
   }

 }

 void loop() {
 while(digitalRead(myButtonArray[0]))
      digitalWrite(myLEDArray[0], HIGH);

 while(digitalRead(myButtonArray[1]))
      digitalWrite(myLEDArray[1], HIGH);

 while(digitalRead(myButtonArray[2]))
      digitalWrite(myLEDArray[2], HIGH);

 while(digitalRead(myButtonArray[3]))
      digitalWrite(myLEDArray[3], HIGH);

 while(digitalRead(myButtonArray[4]))
      digitalWrite(myLEDArray[4], HIGH);     
 }
</code></pre>
 15180: <p>I think, you did not realized, that <code>digitalWrite(i,value)</code> sets the pin <code>i</code> to <code>value</code> <strong>AND</strong> the pin have the <code>value</code> until set otherwise. So you probabelly want something like this:</p>

<pre><code>void loop() {
  for (int i=0;i&lt;5;i++) 
    digitalWrite(myLEDArray[i], digitalRead(myButtonArray[i]));
}
</code></pre>

<p>where each LED follows each respective Button both HIGH and LOW.</p>
