I have a switch statement set up, with 2 cases (a or v). I could have just done an OR, but decided to practice with switch statements.

So far i'm using it to select what letter they type in, then launch the next part of the program depending on the letter they chose. Thing is, if I do:

case 'a':

then if they type "A" it will go to the default. self explanatory. But I want to know, can I add the uppercase A to the same case? Ive tried

case 'a' || 'A':

but that doesnt work.
I dont really want to have

case 'a':
(code here)
break;
case 'A':
(same code here)

etc, taking up lots of room.
Its most likely the simplest fix ever. I seem to ask the most stupid questions at the moment eheh..

thanks for help.

Edited 5 Years Ago by FriXionX: n/a

Just omit the break in the middle. Switch statements "fall through" until they reach a break;

case 'a':
case 'A': //do stuff here
break;

Edited 5 Years Ago by jonsca: n/a

Comments
fast help, thanks.
This question has already been answered. Start a new discussion instead.