It works the same because the value of the last expression in the for
loop is not used for anything. It’s the side effect of that statement that counts. Eg, the value of i
is checked the next time the for loop is executed by the condition check. Try replacing i
in the condition check instead with i++
or ++i
and you would see different results.
Something like: for (int i = 0; ++i < 10;) { ... }
Don’t worry too much about it if it doesn’t make sense to you. It can be really valuable if you’re deploying a substantial amount of IoT devices on the edge with no to little possibility to do over the air upgrades reliably or when the cost of failure is high (i.e. a technician has to be on site to fix it). So, sometimes you just want it to be running as stable as possible for as long as possible without management.