Transcript from the "Incrementing" Lesson
>> Brian Holt: So what I wanted to show you are all the different ways you can do incrementing a number by 1. So friendsAtYourParty += 1. This is saying add 1 to friendsAtYourParty and reassign it. As you might imagine, you could put 5 here and it would add 5 and reassign that, right?
So that would be the same as this.
>> Brian Holt: Line 4 and line 5 are doing exactly the same thing right now.
And /=, which is division. I don't if you ever seen anyone use /=, but it's there. There's also friendsAtYourParty++, like C++, right, we've heard of that. That's because it's 1 better than C, that's joke, right?
>> Brian Holt: Computer scientists have bad sense of humor. So this will take friendsAtYourParty and increment it by 1.
You can also do ++friendsAtYourParty, that also works.
>> Brian Holt: So I'll put this back to 1. All of these do exactly the same thing. Adds 1, adds 1, adds 1.
This is just,
>> Brian Holt: No one ever does it this way. You can, but people don't. People always do ++ on the end, postfix.
>> Brian Holt: Okay, reason why I show this is cuz the next example is going to use this.