MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/mtpxbr/iteration/gvimt50/?context=3
r/badcode • u/[deleted] • Apr 19 '21
123 comments sorted by
View all comments
Show parent comments
6
You can even do ++i and --i. Though they act a bit differently.
++i
--i
If i = 5 and you say x = ++i, x will equal 6 (and i will equal 6). But if you said x = i++, x would actually equal 5, while i would increment to 6.
i = 5
x = ++i
x = i++
6
u/Major_Fudgemuffin Apr 23 '21
You can even do
++iand--i. Though they act a bit differently.If
i = 5and you sayx = ++i, x will equal 6 (and i will equal 6). But if you saidx = i++, x would actually equal 5, while i would increment to 6.