The name of this video is operators lesson. Operators are very small parts of the code but really essential to doing many different things within it. They are part of the control flow family and we've actually been using them quite a bit already. I pointed them out a little bit, but in this lesson we're really going to go into much more detail into the different types of operators and things that we can do with them. Taking our little snippet of code from the last lesson on iteration, we could point out four operators in here. In line 1, we have the equals that's used for assignment, that's an arithmetic operator. In line 2 we have this less than, which is a comparison operator, and that's often used in conditional statements. In line 4 we have the arithmetic operator equals again, and then we have another arithmetic operator plus. They seem commonplace operators, but again, they are essential to getting different parts of the code to operate the way that we want. There are four basic types of operators. There's arithmetic, there's comparison, there's concatenation, and there's logical operators. We're going to start by looking at arithmetic and this should be the most familiar to you. We've already talked about the first five of these and we've been using them in the code we've been writing so far. Two here that might seem unusual, something called a floored quotient. What that does is it returns only a whole number, it doesn't return decimals. So in this example, let's say if x happen to be 105, I'm dividing by 10, then it would only return 10 for x. The other one here that might seem strange is this percent symbol. That only returns the remainder of the equation. In this case I'm dividing 9 by 2 and that's going to return a 1 for x. Why that's important is that if I get that one back, then I know that the number I've divided is odd. So anytime we divide something by two using the remainder, if it returns a zero it's even, returns a one it's odd. With arithmetic operators, there's something called precedence, and the parentheses will override any of this precedence in this top area. What I'm doing is I'm using the parentheses here to demonstrate the correct precedence, because multiplication has precedence over addition and I could force an incorrect precedents, but then that's going to give me a different value than what it would in the normal precedence that's determined by the software. The answer should be 14, it shouldn't be 18. This is the precedence order. It's parentheses, exponentiation, multiplication and division, addition and subtraction. If I have the same arithmetic operator in the line like in the last line at the bottom, where I have 5 minus 3 minus 1, I'm using the parentheses here to show the precedence that happens. So it's going to work from left to right, it's going to subtract three from five first and then subtract one. The answer is going to be one, not three. A useful acronym for remembering the precedence is PEMDAS: parentheses, exponentiation, multiplication, division, addition, and subtraction. Next is comparison operators. These should also seem familiar to you, and we've also been using them and they're going to be much more useful when we take a look at the next lesson, which is using conditional statements, which is the primary way that I used them. There's less than, there's less than or equal to, greater than, greater than or equal to. Important one to point out here is this double equals sign. That's different than the equals, which is an assignment. This is asking the question, is this equal to that? That's really what all the comparison operators are asking, they're asking, "Is this less than that?" They always return a Boolean. Another one to point out here that's interesting is this exclamation point equals, which is a not equal to. I'm going to do a whole lesson on the usefulness of that in some of the coding stuff that we do. Another thing to point out is that writing equals to or less than or equal to or greater than are invalid and these would produce an error in Python. Concatenation, we've seen before from our lesson on datatypes and we use it when we're trying to put two strings together, or if we're trying to put a string to a variable that's holding a string. We could also use concatenation to do that. Last are logical operators which for some can be the most confusing, although the first two are pretty straightforward. They're just and and or, and again, I'll use these probably most of the time in conditional statements. One thing to point out is I can use as many as I want in one line of code. I can also use any combination of and and or as I want in one line of code, depending on the question that I'm asking. Not is probably the strangest one for a number of different reasons. Because one of them is that it does not need two elements to work. I can use it with two elements, in this case, two variables in comparison saying if a is not b, then do this. I can also use it to invert a Boolean. In this example below, which is a bit didactic, but I've fabricated it to demonstrate one rule of not. We have a function here, Rhino Script function is curve, which is asking the question, whatever's being held in string curve, is it a curve? If it's not a curve, if this returns a fault by using not, that's going to convert it to a true. So if this is true, then it's going to run whatever's within the conditional. Again, we'll get into conditionals in the next lesson so you'll explain them more. But essentially know that if it's returning a true, then it's going to run what's in the conditional statement, hence now it's saying that curve is missing. Not is a bit of a odd one, but if you go through that, you can understand the logic of it. That's operators. Again, they're very small part of the code, but very essential in operating in the code and particularly with things like conditionals, which are brain of the code. Again, we'll get into that in the next lesson.