i++和++i傻傻分不清
程序员文章站
2022-03-03 17:00:18
...
i++,++i都会使i加1
假设i = 0
a = i++ # a = 0, i = 1
a = ++i # a = 1, i = 1
简单概括:i++
返回递增前的值,++i
返回递增后的值
i++
a = i # a = 1, i = 1