Question: I have a switch statement:

```
swtich(x)
{
    case 1:
           ...
           break;
    case 2:
           ...
           break;
}

```

I want to put the `...` code in a function but I want to put the break too... So I want something like that

```
void func()
{
     ...;
     break;
}

swtich(x)
{
    case 1:
           func();
    case 2:
           func();
}

```

Break gives error (I know why) but what I can do?

Answer: 
You can't. Best you can do is:

```
swtich(x)
{
    case 1:
           func();
           break;
    case 2:
           func();
           break;
}

```

See [here](http://msdn.microsoft.com/en-US/library/adbctzc4%28v=VS.80%29.aspx) for a discussion of what break is for:

> 
> The break statement terminates the closest enclosing loop or switch statement in which it appears. Control is passed to the statement that follows the terminated statement, if any. 
> 
> 
> 

If you put it in a function, how will it know which loop or switch statement it's supposed to apply to?
You can't put the `break` in another method.

Though if you want `case 1` and `case 2` to do the same thing, this is legal:

```
switch (x)
{
    case 1:
    case 2:
        func();
        break;
}

```