 Hey everybody, this is Brian and welcome to the 11th lamp tutorial today. We're actually not going to write any code What you need to do is go out to w3schools.com and this has been kind of our Itinerary if you will and we are at operators So go ahead and click on operators and I wanted to briefly discuss What is an operator because if you're new to programming the whole concept of an operator? I mean this looks like Ancient Egyptian algebra. I mean you're looking at this going what in the world? So I just want to very briefly explain this so you don't have to sit here and read this and burn this into memory okay first off what is an operator well an operator operates on Variables remember our discussion on variables a variable is something that will change Here we have like the plus operator. You see how you have an x and a y Well the x is a variable and the y is a variable. So you have two variables And the plus you guessed it is addition. So you're adding these two together Example would be two plus two equals four. So if x is two and y is two the results going to be four That's a pretty easy one Same thing with subtraction. I mean some of these are going to now that you understand the syntax are going to be fairly obvious Subtraction multiplication division notice the direction of that slash for division It's the opposite of an escape character Modulus what is where is it? It's not modulus. It's modulus. Sorry That is the remainder of two things divided. So the remainder of x divided by y so five Model is two equals one One of the rarely used functions, but I'm sorry one of the rarely used operators, but it is out there Now negation Minus x what's that do? It's the opposite of x meaning negative two the opposite's nothing Um concatenation Adding two strings together now. I shouldn't say adding two strings together. I should say joining two strings together For example, hi concatenate ha ha. I don't know who came up with that little example, but that's kind of funny Now one of the more common stumbling blocks the equal sign This takes a little bit of getting used to if you're not used to programming X equals y well. This is an assignment. Basically. You're saying x is equal to y That one's pretty simple now x plus equal y That's the same as saying x Equals x plus y Sorry about that. I had to pause the video. My phone was ringing. All right, so this is basically a shorthand You're saying x plus equals y so you're saying x equals the value of x plus y so you're basically just incrementing it by the value of y x minus equals same thing x equals x minus y Now if you want an example, let's say x is five y is two So x plus equals would be seven because you're taking x is five so x equals x so five plus y which is two for these you can almost just Ignore the beginning x equals part and just think of it as x plus whatever Same thing with subtraction The five and two the answer would of course be three because you're taking five and minusing three Multiplication now you see the format. It's x multiply y division modulus and concatenation Pretty simple stuff I almost think for homework. You should you know open up a komodo id or whatever you're using and actually Make a couple variables and play around with this a little bit Now the increment operators we get into this in future tutorials, but I wanted to touch on this Plus plus x and x plus plus pre increment and post increment. What does that mean? Well, this will not make a lot of sense to you until we get into loops, which is coming in a very soon tutorial Basically what you're saying is before You read x increment and then after you've read x increment Like I said won't make a bit of sense until we actually get into loops Comparison operators this will really throw some people off notice. There's two equal signs x equal equal y what does that mean What we're saying is are these two equal to each other? Notice how if we only do one equal sign We're saying x equals y meaning we're assigning the value of x from the value of y So if x is 2 and or i'm sorry if x is 5 and y is 2 Then we say x equals y and then we're saying x actually equals 2 Okay, but if we say equal equal we're saying does x equal y we're asking a question For example true if x equals y so five equal equal eight returns false because five and eight are not the same All right now three equal signs. We're saying are they identical This is a little bit different than most c-style languages If x is equal to y and they are of the same type What does that mean? Well, look at the example here five triple equal Quote five unquote remember our conversation about strings. That's a string That's an integer. They're two different types They may be the same value, but they're different types. So it's going to return false And then x exclamation equals the exclamation means not So we're saying x not equals y So five not equals eight returns true because five is not equal to eight x less than or greater to y It's a quality again. So we're saying five less than or greater than eight equals true Then uh, you know x not equal equal So we're saying they're not identical Once again, you know integer five not equal equal string five returns true x greater x less than greater than or equal to once again, we'll get into looping Lower than or equal to So as you can see there's a lot of things in here and now we get into logical operators like anding oring And you know the and or shortcuts and the not This will be covering here very soon in the f statements. It's where they're most commonly used So you're saying something like You know x equals You know is x equal to six or x or I should say y equal three returns false This is very basic algebra. Um, there's not a lot of mystical stuff to it It may look complicated, but once you actually Get into writing code, which we're going to do next This will be fairly simple Well, that's all for this tutorial. Um, like I said, no code for this tutorial We just wanted to explain these things you're going to see these in action over the coming tutorials So I really wanted a touch base on this This is brian. Thank you for watching. I hope you found this educational and entertaining