Today we are going to talk about the assignment operators. Previously, we talked about the increase and decrease of a number by one. So for example, here we have a variable called W. And if I want to increase it by one, I would just type plus plus, and semicolon. And I printed and I run our program, and as you can see, it has been increased by one. And if I want to decrease it, I would do the same. But what if I want to increase it by more than one?
Let's say we want to increase it by five. What do they do? Well, we cannot just do something like a plus plus and then five, and then semicolon. This is not how it works. If I want to increase W by five, what I would do is I would type w equals w plus five. That means that w here is the old value which equals to five, which equals to 10 plus five, and w is the new value which which equals to the old value plus five.
So now if I save and run, as you can see, I have 15. And if I want to win way to shortcut this operation, what I would do is I would type w plus equals five. And let me delete this one for now I'm going to comment this out. And if I save and run, as you can see, now it equals 15, which means that this line of code is equivalent to this line of code, which is w equals w plus five. And if I want to decrease it by five, I would do the same exactly the same. Instead of writing w equals w minus five, what are you would do is I would just type w minus equals five, and then I should print the value out.
And as you can see, now, it has been decreased by five. So this is this line of code is equivalent to this line of code. And if you want to multiply by five, or even divide by five, or whatever, you just change the operation, this operation by the operations that you want you want to do. So for example, if I want to multiply W by five, what I would do is I would type w multiply which is v star, the star sign and then equals five which is equivalent to w equals w. And then star five and I'm going to show you both both of these lines. So if I run this for the Firstly, if I run This, I would get 50 because five multiply by 10, the value is 50. But if I use the other equivalent syntax, I would type W star equals five.
If I run now the value is 50 again, so I can do that with division, multiplication and subtraction. So what I want you to do is to practice using this syntax, which is the operation and then equals, and then the number that you want to add or divide or subtract from the old value.