need help or suggestion on syntax.

I am reading 5 buttons with the Bounce function (bounce1, bounce2, etc...). I would like to read them with a 'for loop'. Is there a way to do this with say a 'bounce(x).read' or something like that?

Declare an array of 5 Bounce objects.

Bounce myBounce [5] = {
{BUTTON0,  period  }, {BUTTON1, period }, {yadda } };
...
...

...
...
for (int i = 0 i < 5; ++i) {
  int state = myBounce [i].read ();
}

Create an array of Bounce objects, and use them:

Bounce bouncer[5];
bouncer[0] = Bounce( BUTTON,5 ); 
bouncer[1] = Bounce( BUTTON,6 ); 
bouncer[2] = Bounce( BUTTON,7 ); 
bouncer[3] = Bounce( BUTTON,8 ); 
bouncer[4] = Bounce( BUTTON,9 ); 

int vals[5];

void loop()
{
    for(int b=0; b<5; b++)
   {
       bouncer[i].update();
       vals[b] = bouncer[i].read();
   }
}

Thanks for the rapid response guys.
I tried your (AWOL and PaulS) suggestions and got compile errors. After tinkering with the syntax I was able to compile and upload. But I got some bizzare results. i.e. buttons seemed to be switched around randomly (button1 became button4, etc.) also the digits being displayed were not incrementing correctly (1, 9, 5, 2, etc.).
I do have a working sketch, I was just trying to simplify my code.

I was wondering if anyone could explain my bizzare results. Thanks.

I am using an Arduino Mega and IDE v18.
Here is my sketch:

I remarked out the bad code just above the working code.

/*
 * Electronic Door Lock.
 * Created 2/23/10 by Corey Johnson
*/

#include <avr/sleep.h>
#include <TimedAction.h>
#include <Streaming.h>
#include <Bounce.h>

#define ledPower 7
#define button1 6
#define button2 5
#define button3 4
#define button4 3
#define button5 2

/*
  * This code does not work correctly. Why?
 * Bounce bounce[5] = {bounce[0] = Bounce(button1, 15), bounce[1] = Bounce(button2, 15), bounce[2] = Bounce(button3, 15), bounce[3] = Bounce(button4, 15), bounce[4] = Bounce(button5, 15)};
 */

// This code works correctly.
Bounce bounce1 = Bounce(button1, 15);
Bounce bounce2 = Bounce(button2, 15);
Bounce bounce3 = Bounce(button3, 15);
Bounce bounce4 = Bounce(button4, 15);
Bounce bounce5 = Bounce(button5, 15);

TimedAction timedAction = TimedAction(100, 60000, sleep);

// This is the Unlock code (in HEX) to unlock the door. 
byte code[4] = {0x31, 0x32, 0x33, 0x34}; // Correct ode is "1234".
byte digit[4]; // This array holds the current digits as seen on the LED display.

byte sleepStatus = 0;

void setup() {
  
  Serial.begin(115200); // For serial monitor (for debugging and future features).
  Serial1.begin(9600); // For sending data to serial 7-segment display.
  digitsReset();
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  pinMode(button3, INPUT);
  pinMode(button4, INPUT);
  pinMode(button5, INPUT);
  pinMode(ledPower, OUTPUT);
  digitalWrite(button1, HIGH);
  digitalWrite(button2, HIGH);
  digitalWrite(button3, HIGH);
  digitalWrite(button4, HIGH);
  digitalWrite(button5, HIGH);
  digitalWrite(ledPower, HIGH);
}

void loop() {
  timedAction.check();
  boolean enterCode = buttonScan(); // scan  all buttons and return with button5 state.
  digitsOut();
  if (enterCode == LOW) {
    boolean yesNo = checkCode();
    if (yesNo == HIGH) {
      digitalWrite(ledPower, LOW);
      Serial << "Code is correct. \n";
      delay(500);
      Serial << "Door is Unlocked! \n";
      delay(6000);
      /*
       * This is where the code to control the lock will go.
      */
      Serial << "Door is now Locked! \n";
      digitsReset();
    }
    else {
      digitalWrite(ledPower, LOW);
      Serial << " \n" << "Incorrect Code!!! \n" << " \n";
      delay(500);
      Serial << "Door Remains Locked! \n";
      delay(2000);
      digitsReset();
    }
  }
}

void digitsReset() {
  for (byte i = 0; i <= 3; i++) {
    digit[i] = 0x30;
  }
  digitalWrite(ledPower, HIGH);
  delay(100);
  digitsOut();
  timedAction.reset();
  return;
}

void digitsOut() {
  for (byte i = 0; i <= 3; i++) {
    Serial1 << byte(digit[i]);
  }
  return;
}

boolean buttonScan() {
  boolean digitVal;
/*
 *
 * ?? This is the code that is not working correctly. Why?
 *
 * for (byte i = 0; i <= 4; i++) {
 * bounce[i].update();
 * digitVal = bounce[i].read();
 * if (i < 5) {
 *   if (digitVal == LOW) {
 *     if (digit[i - 1] == 0x39) {
 *       digit[i - 1] = 0x30;
 *     }
 *     else {
 *       digit[i - 1] = (digit[i - 1] + 0x01);
 *     }
 *   }
 * }
 * delay(100);
 *
*/

// This code works correctly.
  bounce1.update();
  digitVal = bounce1.read();
  if (digitVal == LOW) {
    if (digit[0] == 0x39) {
      digit[0] = 0x30;
    }
    else {
      digit[0]++;
    }
  }
  bounce2.update();
  digitVal = bounce2.read();
  if (digitVal == LOW) {
    if (digit[1] == 0x39) {
      digit[1] = 0x30;
    }
    else {
      digit[1]++;
    }
  }
  bounce3.update();
  digitVal = bounce3.read();
  if (digitVal == LOW) {
    if (digit[2] == 0x39) {
      digit[2] = 0x30;
    }
    else {
      digit[2]++;
    }
  }
  bounce4.update();
  digitVal = bounce4.read();
  if (digitVal == LOW) {
    if (digit[3] == 0x39) {
      digit[3] = 0x30;
    }
    else {
      digit[3]++;
    }
  }
  bounce5.update();
  digitVal = bounce5.read();
  delay(250);
  return digitVal;
}

// Function to compare entered code with Unlock code.
boolean checkCode() {
  boolean goodBad;
  if ((((digit[0] == code[0]) && (digit[1] == code[1])) && (digit[2] == code[2])) && (digit[3] == code[3])) { 
    goodBad = HIGH;
  }
  else {
    goodBad = LOW;
  }
  digitsReset();
  return goodBad;
}

// Fuction to put the arduino into sleep mode.
void sleep() {
  digitalWrite(ledPower, LOW);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  attachInterrupt(0, wakeUp, LOW);
  sleep_mode(); // Arduino Enters sleep mode at this Point.
  /* 
   * Sleeping - ZzZzZzZzZz...
   * Pressing button 5 will wake-up arduino.
  */
  sleep_disable(); // Arduino Exits sleep mode at this point.
  detachInterrupt(0);
  digitalWrite(ledPower, HIGH);
}

void wakeUp() {
}
Bounce bounce1 = Bounce(button1, 15);
Bounce bounce2 = Bounce(button2, 15);
Bounce bounce3 = Bounce(button3, 15);
Bounce bounce4 = Bounce(button4, 15);
Bounce bounce5 = Bounce(button5, 15);

Bounce* myButtons [5] = {&bounce1, &bounce2, &bounce3, &bounce4, &bounce5};  //Ugh! Nasty!

Can you please use the Code (#) button in the editor when posting code?