Else for a Switch statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello !

In c# , I have a Switch statement , and I want to add default value that
will be executed , if all the other "case" options not match to the condition.
What is the syntax to else (all the other "case" options not match to the
condition) in switch statement?

Thank U !!!!
 
Hi Niron,
In c# , I have a Switch statement , and I want to add default value
that
will be executed , if all the other "case" options not match to the
condition.

In C++:

switch(flag)
{
case Foo:
break;
default: // this is what you're looking for
// do something
break;
}

Not 100% sure about C#, but I think it's the same. Try a C# newsgroup.
 
Thank U Kim !

Kim Gräsman said:
Hi Niron,


In C++:

switch(flag)
{
case Foo:
break;
default: // this is what you're looking for
// do something
break;
}

Not 100% sure about C#, but I think it's the same. Try a C# newsgroup.
 
Back
Top