 Hey everybody it's Brian. This is our 11th C++ video. Today we're going to be discussing flow control, specifically the if statement and the switch statement. Okay let's just make a variable called i and let's say uh if i equals zero then cout yes. Now what is going on here? We have our if statement and if you're coming from other programming languages, which you should be, you understand what an if statement does. So those of you that don't want to go over it real quick. If and then you have an expression and you're evaluating this expression i equals zero. If i equals zero then run this code. If it doesn't it just jumps right over and ignores it. Now you notice that there's two equal signs. If you're coming from like a Java or C sharp you understand this concept. Visual basic users might find this a little bit confusing. If you have just one equal sign you're actually assigning the value. So let's say two if i equals two cout. We know i equals zero and here we're saying if i equals two. I'm going to show you how it assigns it. See how it says yes but we know that it was zero. What we've done is we've actually assigned i with the number two. We can prove that by cout i and l. This is just a common programming mistake people make when they're entering a language like c++. You can see how it's printing the number two. So we've actually assigned it. So what you need to do is do the quality operator or two equal signs. You know jump over it and sure enough there's zero and it didn't print yes. Let's get rid of that. That's the basic if statement. The more complex version has literally a block of code where you can do multiple things. We'll just say happy land. So let's just set the is it equals zero and it prints out yes happy land. So you can see you can get much more control and do many actions. What you can also do is an else. Now how you read this is if i equals zero then execute this. Else execute this. So let's just cut out happy land here. Put no. And let's set this to something we know it's not going to be. So 99. Sure enough prints no. That is basic flow control and the foundations of polymorphic algorithms right there is the if statement. Now if statements can also be nestled. In other words you can say if i is less than five then. And let's actually say if i is greater than one. Whoops. So we're going to say if i is greater than one. Yes. And if it's less than five we're going to say less than five. And let's actually set this to a number we know it's going to trigger. So we have i equals three. So we're going to say if i is greater than one which it is it'll execute this code block. Now inside we have another block says if i is less than five execute this. And you can even throw an else in there. We'll say more than five. So let's run this and see what happens. It says yes less than five. As you can see our three is in our yes block. And it is less than five. Now let's say oh six. What do you think is going to happen here? Well if you guessed it's going to print yes and more than five you get a gold star for the day. There we go. More than five. That is the if statement in a nutshell. I hope you found this video educational and entertaining and thank you for watching.