Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
An assignment has a return value. For ++a it is the new value, for a++ the old one. This can be convenient: You can print out the old value AND increase a 'at the same time'. If you write a=a++, though... You increase a, but the process returns the OLD a, and then you store it in a. So basically you increase a, then directly cancel it out by writing the old value into a again.
22nd Feb 2019, 11:22 AM
HonFu
HonFu - avatar