Welcome back.
In this video I want to show you some more operators.
And therefore I'm going to create a variable called num which I'm going to assign zero to.
And then what I want to do is I want to increment that number where we had this variable called score.
And we said score equals score plus one okay.
And then we saw that score plus plus would have been a faster solution for that same problem.
Now let's just use that with num.
So I have a num and I want to show what num is.
So num is zero or num is let's say num like so to keep it simple.
And now if we print that out our console will close.
So let's make sure that it stays alive by eating a red key or red line at the end.
It doesn't matter.
Each of those is fine.
So now if I increment it.
So here I use increment sitting of variables or of ints.
So here I can say num plus plus okay.
And then in the next line I'm going to again say num is and then in curly brackets num again like so.
And now if we run it again we will see that num is zero at first and then it's one.
So this is what incrementing looks like.
The thing is, it does matter if you are incrementing before or after the variable name.
So let me do this again.
Plus plus num.
So there is not just num plus plus but also plus plus num.
So you would use that if you wanted to increment before using the variable.
So if I now use let's say another Console.WriteLine statement where I say num is and in this case.
In this case I'm going to use string manipulation.
I'm going to use num and I'm going to use num plus plus okay.
So you recall maybe this was string interpolation.
And now I'm using string formatting.
So here I'm using num is whatever num is.
But I increment it by one.
So by doing it this way I will not get as you would expect one I will get two.
So you see num is two.
So let me show you this once again.
But this time I'm incrementing num after the fact.
So here I'm adding the pluses after the num keyword and you will see num stays two.
Because let me add another one where I don't increment num at all.
I leave num as it is and I run it and let me just make it here or add it here.
You see, num now is three.
So what is going on here.
So we start here at the top where we say num is zero and we display num okay.
So this is where we display it in line four.
NUM is zero.
So in line six we increment it by one.
In an inline seven we're displaying num okay.
So this is in line seven.
Then in line nine which is this line.
Here we are incrementing before num is used.
So that means that num suddenly is two and we're displaying it as two.
Then in line ten we're incrementing after the name of the variable.
And that way it is the same and is only incremented for the next line.
Okay.
And then finally we display what num is at that point which is num 11.
So you could call this one pre incrementing pre incrementing and this line here okay.
So that's incrementing.
And now the same concept works for Decrementing.
And that's what we're going to look at in the next video.