Hello, my name is Mark Nair, and in these lessons you'll learn about statements, loops and conditionals. One of the most important things you'll do with your code is control the flow of your logic. You'll do this by using logical operators and checking the conditions of those operations. The way we do this is by using the simple word, if. If something is true, run some code. If it's false, run some other code, it's really that simple. Let's set up a couple of constants and add some basic control flow. All right, so I have, on line one, let firstNumber = 5, and then let secondNumber = 10. So I have two constants right there, one called firstNumber, one called secondNumber, and then I'm making my conditional. So I'm saying if firstNumber is less than secondNumber, then I'm gonna run some code if that is true. And the way we do this is we put this in curly braces. I can double click the curly brace and see all the information that's inside of it here. So the code that runs inside of this curly brace and this curly brace is what's going to happen when the condition evaluates to true. So if firstNumber is less than secondNumber then print firstNumber using string interpolation is less than secondNumber. And down in the debug area, we see 5 is less than 10. So that's true. Now, if I change the value of firstNumber to 55 and run it, nothing happens, because what I've said is if firstNumber is less than secondNumber, print something, but I haven't said what to do otherwise. Now we can use logical operators and comparison operators to help us evaluate our expressions. To check if things are exactly equal, we use two equal signs like this, if firstNumber is equal to secondNumber. So 55 is equal to 55. Two equal signs means is this equivalent, is this exactly equal. This of course works with strings as well. So here I have a constant called let userName = Joanna and then let secondUserName = Joanna, and this one is all in caps right here on line two. Then, I'm saying, if userName lowercased is equal to secondUserName lowercased, so I need to put everything equivalent, remember, everything is case-sensitive. So if I don't have lowercased it will evaluate this as false, but since I've made both lowercased, then I can see what's going on, someone already has that name. To check if things are not equal, we'll use exclamation mark equal. So here, my two constants back, firstNumber, secondNumber, if firstNumber is not equal to secondNumber, print, these numbers are unequal, and 42 is not equal to 55. If firstNumber was 55, nothing happens. We can use regular mathematical expressions such as greater sign, greater equal, less than, less than an equal, the things that you are probably familiar with from grade school. But there are two other operators I do wanna talk more about, and that is the and operator. Let's take a look at that. Now in this expression, I have the constant temperatureInFahrenheit is equal to and, an integer of 72, and isSunny is equal to, is a Boolean type which is equal to true. Then I'm saying if temperatureInFahrenheit is equal to 72, then two ampersands, which means and, isSunny equals true. This means that both sides of this expression, temperatureInFahrenheit equals 42, and isSunny equals true, must be true. And means both, then print, what a great day for a bike ride. If I change the value up here to 79 and run it, nothing happens because temperatureInFahrenheit is not equal to 72, even though isSunny is true. Both have to be the same. We can simplify this by, taking isSunny equals true and just removing, equals true, because the way these values work, the Booleans, is we can just say isSunny. The default in that is true. So if temperatureInFahrenheit equals 72 and isSunny, which means, is Sunny equal to true. And it's the same result. So when you see this that's exactly what that means, it's equal to true. Now, the other one that I'd like to talk about is or. In this example I've established isSkiing is a Boolean with a value of false, isSnorkeling is a Boolean with a value of false. Then I'm saying, if isSkiing, and then these two pipes, that's what the character is called, it's right over the Return key on the keyboard. Two pipes means or, the logical operator or, so if skiing or isSnorkeling. So if skiing is true or if snorkeling is true, print, you'll have a fun time. Now this will print nothing because both are false. If I change isSkiing to true, then I see the result, you'll have a fun time. So if isSkiing is equal to true or isSnorkeling is equal to true, then print, you'll have a fun time, but of course we compressed this. So it's just, if isSkiing or isSnorkeling. So there's a lot of complexity and a lot of things you can do with your control flow inside your code using these logical operators and the if statement. Thanks for watching, stay tuned for the next lesson where I'll show you how to use else and else if to create your if constructions.