Can you choose more than one case ?
| katielynnsdad (34) | |||
| can you choose more than one case in a switch statement? Or, how can you choose witch dice to keep in a dice game? Say you roll five dice and you need to keep 3 at different places in your array of dice? | |||
| msram (19) | |||
| @katielynnsdad: I understood only the first question. And the answer to that is 'yes'. It is possible to execute more than one cases in a switch statement. In the switch statement, once a case condition is met, the execution flow continues till it sees a break statement.
| |||
| ropez (312) | |||
| @msram: I think what he meant was something like:
If i equals 1, then choose both case "A" and case "B". In general this isn't possible. | |||
| msram (19) | |||
| @ropez: Not yet sure. Let's see what the original author says! :) | |||
This topic is archived - New replies not allowed.
