Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Succint way to write multiple case values? 1

Status
Not open for further replies.

RLMuller

Programmer
Mar 7, 2003
15
0
0
US
Is there a more succinct way of writing the following:

select (myInt)
{
case 1:
case 2:
case 3:
...

Perhaps as:

select(myInt)
{
case 1, 2, 3:
...
 
The C# language defines it like this:
Code:
switch (expression)
{
   case constant-expression:
      statement
      jump-statement
   [default:
      statement
      jump-statement]
}
For "constant-expression:" (note the colon!), it says "Control is transferred to a specific case according to the value of this expression." There's no mention of a range of values, or a list of expressions.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top