1 00:00:03,150 --> 00:00:09,690 All right, let's take a look at assignment operators, and we've seen the first one a lot so far, 2 00:00:10,590 --> 00:00:16,080 so the first one is the straight assignment, which just assigns a value from the right side to the 3 00:00:16,080 --> 00:00:16,600 left side. 4 00:00:17,340 --> 00:00:20,010 So what X equals five is an assignment. 5 00:00:21,300 --> 00:00:26,430 And then we have these other ones that combine assignment in an operation. 6 00:00:27,360 --> 00:00:28,950 So, for example, plus equals. 7 00:00:29,670 --> 00:00:35,100 So what X plus equals five says add five to X an assignment. 8 00:00:35,110 --> 00:00:39,320 So X started out as 10 after you did this. 9 00:00:39,330 --> 00:00:40,830 It would have the value five. 10 00:00:41,580 --> 00:00:42,540 I'm sorry, 15. 11 00:00:45,560 --> 00:00:51,830 And one bad thing about these examples is they shouldn't really have the words let here because you 12 00:00:51,830 --> 00:00:54,560 can't declare a variable and say plus equals five. 13 00:00:55,730 --> 00:00:58,610 So the variable would already have to be declared. 14 00:00:58,610 --> 00:01:01,860 So X plus equals five, X minus equals five and so on. 15 00:01:02,750 --> 00:01:06,210 So we can and this list is much longer than this. 16 00:01:06,890 --> 00:01:12,190 So every operator you can do an assignment equals like this. 17 00:01:13,190 --> 00:01:16,940 So I just covered six and we'll take a look at some examples. 18 00:01:19,500 --> 00:01:21,300 OK, so this should be pretty quick. 19 00:01:22,710 --> 00:01:33,510 Well, do is how to find a variable with value equals five and then I will do one of these operators 20 00:01:33,960 --> 00:01:36,070 with an equals and we'll see the result. 21 00:01:36,810 --> 00:01:45,740 So then I'll say value plus equals two and then I'll slug it out. 22 00:01:53,600 --> 00:01:55,300 All right, let's run the first one. 23 00:01:57,790 --> 00:02:04,030 So now has to buy you seven, because it started out as five, we add two to it and reassign it back. 24 00:02:05,020 --> 00:02:12,400 So let's do this with the other operators plus plus equals minus equals times equals. 25 00:02:12,400 --> 00:02:14,050 Divided equals, percentage equals. 26 00:02:14,680 --> 00:02:18,070 And like I said, there's much more that could be done. 27 00:02:19,390 --> 00:02:22,930 Minus equals, times equals. 28 00:02:24,160 --> 00:02:29,950 And we do the remainder first because otherwise I'm going to have a 29 00:02:33,010 --> 00:02:34,000 fractional number. 30 00:02:38,580 --> 00:02:40,740 All right, let's see what this does. 31 00:02:46,070 --> 00:02:54,920 And we got this to the end and ended up being zero, so so minus two took it back to five times to took 32 00:02:54,920 --> 00:02:58,960 it up to ten, ten remaindered two. 33 00:02:58,970 --> 00:02:59,920 There is no remitters. 34 00:02:59,930 --> 00:03:04,680 That's why that zero and zero divide equals two is still zero. 35 00:03:06,020 --> 00:03:11,570 So let's shake this up a little bit with something divisible by two. 36 00:03:15,510 --> 00:03:16,670 So let's do that. 37 00:03:22,350 --> 00:03:32,610 So now when we do the 21 and the remainder to so the remainder of that one because 21 divided by two 38 00:03:32,790 --> 00:03:39,450 is 10 as an integer with a remainder of one and then one divided by two point five. 39 00:03:40,740 --> 00:03:47,190 So the important thing to remember is that it actually changes the variable and and then there's other 40 00:03:47,190 --> 00:03:48,890 many other possibilities. 41 00:03:49,890 --> 00:03:53,740 So any other operator we've talked about could be that operator equals. 42 00:03:54,390 --> 00:03:56,240 So that is it on operators. 43 00:03:56,250 --> 00:04:04,110 I'm going to put a link to the Mozilla documentation on Operator Precedent's to show you, at least 44 00:04:04,110 --> 00:04:06,810 with the long list of precedents of operators are. 45 00:04:07,260 --> 00:04:13,740 So we know the Times has more precedence than plus and we know that the end has more precedence than 46 00:04:13,740 --> 00:04:14,250 the other. 47 00:04:14,940 --> 00:04:16,320 But it is a long list.