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?
As others have said, it's not possible. Look at it this way, what would be the expected behavior be if you were not inside a switch statement when the execution gets to the `break;` line?

Put the `break;` statement after the function call. If you want the function to stop execution under a given condition, use the `return;` statement.