数据分析师2017-09-30 23:07:51
Don’t quite understand that sum=sum+mymoney lasts ten times and gets 55 homesickness? -PHP Chinese website Q&A-I don’t quite understand sum=sum+mymoney. Finally, after looping ten times, I get 55 homesickness? -PHP Chinese website Q&A
Please watch and learn.
迷茫2016-12-20 11:59:33
sum的初始值为0,mymoney的初始值为1时,
sum=sum+mymoney=0+1=1;
mymoney++=1+1=2;
sum=sum+mymoney=1+2=3;
一直循环下去,最后sum就是55啊。
如果最后sum等于110,那就要看你的mymoney的初始值和每次递增的度是多少了。