 Hello everybody and welcome back to C++ programming, I'm Redo the Null. In the last video we were looking at default arguments for our functions. We were looking at an example with just a person and kind of the the letter that they associate with person A person B person C that sort of thing and they had an age and these were typically defaults in our functions. If we were to run this code you'll notice person A which we have not supplied in the execution of our function it's just going to be default from this variable here. That's going to say hello and he's age 20 which again we have not supplied it's just a default parameter. Cool! Now let's continue with our concepts. I'm going to go ahead and create a new script, not a new script but a new file in this case. I'll call mine 09 underscore if statement dot cpp and you get it. I'm sorry you guessed it I don't know why I said the wrong thing there. I must be nervous. You guys make me nervous. Have I ever told you that? Standing up here speaking into a computer screen knowing that tons of people are listening. Right. Okay in this video we're going to talk about the if statement and the if statement is incredible. Now there are a lot of things that I kind of I talk about and I say when it comes to programming that are like crucial and super duper important to your understanding of programming and that sort of thing. Well I cannot stress it enough with the if statement. It allows for a different kind of logic flow. It allows you to test whether or not things are the way that they are. It allows you to determine things under a condition which is cool. So the syntax is really simple in C and C plus plus it's just simply the word if on a space and the condition in C has to be inside parentheses. So if we have a condition if that a condition is true then we will run a code block which will of course do stuff in the code block. It can be it can be it can do a ton of things and that's how it works. So let's just start this up if we say hello hello world at the start of our program. Let's do end L let's do another end L. Let's say integer of subscribers subscribers equals a thousand then okay we've got that variable right there. Let's test. Let's test in our if statement. Let's modify our condition. Let's say if the variable subscribers is equal to one thousand. Now you notice I've used the one equal sign to assign the value of one thousand to the variable subscribers. That's what this equal sign is. It is an assignment operator. Now in an if statement you've got a little bit of a different thing going on. An if statement worries about conditions which actually have to do with comparison. So this it subscribers equals one thousand is not what we're trying to say here. We don't want to say if subscribers equals one thousand. We want to know if subscribers is equal to one thousand. It's comparing these things. So we have what's called comparison operators or testing operators. So we don't use in an if statement we don't use one equal sign. We use two because this means if this is equal to that. You can think that these two equal signs means is this equal to. Now we can test. Okay. Yes. We have one thousand subscribers. Hallelujah. And then end the line there. Cool. Let's return zero before I forget. And let's run our program. I'll hop over to my terminal. I'll G plus plus oh nine and then run eight out out. Oh no. That should be a okay. Hello world. Yes. We have 1000 subscribers. Awesome. Now this statement is only happening because subscribers is equal to one thousand. If I were to change subscribers if I were to change subscribers is going to be equal to zero. No one loves me. Absolutely. Everyone hates me. They don't watch my videos. If I run this code all it says is hello world. This line this execution of output. Yes we have 1000 subscribers. That's not happening because this this condition is now untrue. It returns false. If subscribers equal to 1000. No it's not. We know that subscribers is equal to zero. Now what if I did the other way around. What if I tested. Okay. Subscribers can equal zero. Sure. That's just fine. If I run this. Yes we have zero subscribers in this case. Yes we have zero subscribers. What if we tested we had if subscribers could be 20. Yes we have 20 subscribers. Well you know that's not going to happen either because subscribers is zero and it's testing if this is 20. They have to match up. They have to be equal. They have to have to meet a true condition. And that condition inside these parentheses is what's being tested with this if statement. That's all that it means. It's just an if condition. And that's the point that I'm trying to get across. So thank you for watching guys. Very very simple. Very very easy but a fundamental understanding in programming and programming concepts. So we'll continue off this very very soon. In fact in the next tutorial. Thanks for watching everybody. See you then.