The next flow of control statement that we're going to look at is called the Switch statement. At one level it's a bit of a generalization of an if then else because you can accomplish pretty much the same thing with an if then else. But structurally for certain particular control flow the switch statement is more elegant and the code that you obtain is more readable. So in a switch statement, basically you switched on an integral expression. So simple one might be the integer i, and then you have a bunch of cases and those cases can, Be critical cases where you want to do different things depending on some small value of i. So let's look at an example. Here's an example. We have the keyword switch. Then we have an integer expression i, which would have to have a value before we enter here. And then we have what effectively our three cases. We have case, a keyword with an integer constant. So in this case is the constant 1. A colon, and then we have a series of statements that will get executed if i was equal to 1. In this case, we have a simple assignment statement a equals 2 times i. And then we have this special flow of control statement break. And what break means is if you get here jump to the next statement that goes after this closing brace. And this is idiomatic. If you didn't have the break here you would have what's called fall through semantics. So imagine if break was no longer here, then you would execute case 2, and there you would have a a sign, three times I which point you'd have a break. Okay, so here the notion is there are three things we want to do, either i is 1, i is 2 or i is some other value. For another value, that's the special keyword which constitutes everything else called a default colon. And again you have some series of statements in this case a single statement, and then you fall out of the case. So what you're looking at syntactically is switch an integral expression, it can't be floating point, it must be integral. But it could be something like a short or a long in, or ASCII value for character. And then you have the series of cases that are going to be enclosed in these braces. And the braces sort of act like a block and the case is act what what we call case labels. They basically tell you the switch jumps to one of a number. And if that expression is not seen in this list then you go to the default. If there is no default, then you just don't do anything and you leave. So normally idiomatically again, you would typically have cases, delineate it by brakes, and then finally, a default. That is your standard switch statement. [MUSIC]