Let me start this thread by thanking those of you who have helped me tremendously over the last week by providing in-depth feedback to my other questions. The time you take on your replies shows a genuine desire on your part to help someone who's learning, and it most certainly is appreciated, so thank you.
Switch Case:
The books for beginners I have, as well as internet searches reveal little information on switch case statements. I understand the usage, some number or variable is tested, and depending on the result, one of a number of instructions are executed. These pieces of literature don't really go into any depths on exactly how they operate though, which is where my questions come from.
For instance, I have only recently figured out through testing that an if statement is not a continuous loop like a while statement. The condition is tested and if true, the if instructions are executed once, and not continuously until the program comes back around to the if statement again (assuming it's still true). I have to assume from this, that the switch case is the same way?
I have seen the switch case examples only in the form of:
Can each case contain multiple instructions using braces "{}" or is a case limited to 1 instruction and the break statement.
Finally, for now... what exactly does the "break" statement do?
Thanks
Switch Case:
The books for beginners I have, as well as internet searches reveal little information on switch case statements. I understand the usage, some number or variable is tested, and depending on the result, one of a number of instructions are executed. These pieces of literature don't really go into any depths on exactly how they operate though, which is where my questions come from.
For instance, I have only recently figured out through testing that an if statement is not a continuous loop like a while statement. The condition is tested and if true, the if instructions are executed once, and not continuously until the program comes back around to the if statement again (assuming it's still true). I have to assume from this, that the switch case is the same way?
I have seen the switch case examples only in the form of:
Rich (BB code):
switch(x)
{
case 1:
instruction;
break;
case 2:
instruction;
break;
etc...
}
Finally, for now... what exactly does the "break" statement do?
Thanks