So i’m dealing with the Race Day project and it wants you to add 1000 to the raceNumber if they are over 18. When looking over the video it shows the equation raceNumber += 1000. My question is what is the difference between using + vs +=. Would raceNumber + 1000 result in the same number?
I think I may have figured it out. I assume + just simply adds two things together where as += assigns or changes a variables data or however it’s suppose to be worded. So if raceNumber is 5 for example and you just use + 5 it will give you 10 where as if raceNumber was 5 and you += 5 it would assign 10 to raceNumber. Is that on the right track?
Yes. The equivalent of
raceNumber += 1000 would be
raceNumber = raceNumber + 1000
In both cases, the variable
raceNumber is reassigned to the result of adding 1000 to the original value.
Much appreciated that was confusing me there for a moment.