Quiz program issue

So I am working on a small project for school. It consists out of a X-Y table that is controlled by stepper motors and a whole series of buttons & LED's that are used in a quiz. Now I have found some code that I could use perfectly for the quiz part. The code only had 3 buttons & LEDs to press to "play" the quiz so I added 12 more because I need to have it for an entire class of students. For some reason it gives me this error on all the code I added after those first 3.

'b5State' was not declared in this scope

Now, the code is probably a bit sloppy because I'm not that good in coding. But just to explain it in short. b1,b2,b3 are the quiz buttons. b4 is the reset button and b5 - b16 are the other quiz buttons. I've been pulling my hair out trying to figure it out, so any help is highly appreciated!

Mind you, the code for the stepper motors works fine.

Quizschakeling_en_stappenmotor.ino (15.8 KB)

Quite apart from the fact that you could do what you want more neatly using arrays, the compiler wasn't lying when it reported that b5State was not declared. Nor are many other variables declared

See this code

uint8 b1State,b2State,b3State,b4State = 0;

It declares 4 variables.

Where is the corresponding declaration for b5State (and others) ?

UKHeliBob:
Quite apart from the fact that you could do what you want more neatly using arrays, the compiler wasn't lying when it reported that b5State was not declared. Nor are many other variables declared

See this code

uint8 b1State,b2State,b3State,b4State = 0;

It declares 4 variables.

Where is the corresponding declaration for b5State (and others) ?

Oh, I actually totally missed to change that part of the code. It works! Thanks!

It works!

Now improve it by using arrays. For instance, this block of code

    b1State = digitalRead(button1);
    b2State = digitalRead(button2);
    b3State = digitalRead(button3); 
    b4State = digitalRead(button4); 
    b5State = digitalRead(button5);
    b6State = digitalRead(button6);
    b7State = digitalRead(button7);
    b8State = digitalRead(button8);
    b9State = digitalRead(button9);
    b10State = digitalRead(button10);
    b11State = digitalRead(button11);
    b12State = digitalRead(button12);
    b13State = digitalRead(button13);
    b14State = digitalRead(button14);
    b15State = digitalRead(button15);
    b16State = digitalRead(button16);

Could be done in 2 lines of code using an array of button pins and states and a for loop.