WEBVTT 0 00:00.680 --> 00:06.800 Now so far what we have seen are all operators that exist in normal mathematics. 1 00:07.020 --> 00:10.970 But here are some that only exist in programming. 2 00:11.310 --> 00:14.050 So take a look at this expression. 3 00:14.070 --> 00:17.590 We create a variable called x and we set it equal to 5. 4 00:17.700 --> 00:23.760 Then we change the value of x to the previous value, which is 5, plus 1. 5 00:23.880 --> 00:26.070 So x now equals 6. 6 00:26.070 --> 00:29.790 Now we've seen this and we've been using this in our previous code. 7 00:29.850 --> 00:31.870 So this should be familiar to you already. 8 00:31.920 --> 00:39.360 But in most programming languages, instead of writing out x = x + 1, you can simply write 9 00:39.420 --> 00:49.260 x++, and, in exactly the same way, x now gets incremented by 1 and is now equal to 6. So x++ 10 00:49.650 --> 00:56.760 is the equivalent of saying x = x + 1, and this is called the increment expression. 11 00:56.760 --> 00:58.740 Now you can go the other way as well. 12 00:58.740 --> 01:00.950 You can write x--, 13 01:01.080 --> 01:05.250 and this is equivalent to x = x - 1. 14 01:05.280 --> 01:10.650 So the previous value of x, 5, minus 1, so x now equals 4. 15 01:10.920 --> 01:13.440 And this is called the decrement expression. 16 01:13.440 --> 01:20.670 Now you might have heard of the programming language C and C++, and this is kind of like a programmer's 17 01:20.670 --> 01:24.720 idea of a good joke, even though nobody else thinks it's funny. 18 01:24.750 --> 01:31.100 But essentially C++ was meant to be an increment on the C programming language. 19 01:31.110 --> 01:37.920 So it's kind of like C plus one, a little bit better than C. Remember that with ++ and --, 20 01:38.040 --> 01:40.890 you're only ever changing the value by one. 21 01:40.890 --> 01:47.790 Now if you ever want to increase the value of x by more than one, then you can use the +=, and 22 01:47.800 --> 01:52.280 this is equivalent to saying x = x + 2. 23 01:52.350 --> 01:55.400 And so x now equals 7. In the same way, 24 01:55.410 --> 02:00.530 you can also use += to increase by the value of another variable. 25 02:00.540 --> 02:05.370 So in this case x = x + y, which is equal to 8. 26 02:05.370 --> 02:10.270 And this also works with -=, *=, /=, 27 02:10.410 --> 02:13.850 and it's a handy shorter way of doing exactly that. 28 02:13.860 --> 02:15.660 So, in the next lesson, 29 02:15.690 --> 02:19.620 I have a brief quiz for you to see if all of this stuck 30 02:19.740 --> 02:21.390 and if it makes sense. 31 02:21.480 --> 02:27.300 So head over there and see if you can complete the multiple choice question and I'll see you on the 32 02:27.300 --> 02:28.190 next module.