mmcp42:
ahh nods sagely
guess it's one of those things that you'll need one daythink I'll stick to "easier-to-read" rather than save a byte or two
thanks for the explanation though!
First off, I must apologize - I made a mistake: The notation "{var} {operator}= {value}" is actually a form of an assignment operation, and has nothing to do with pre- and post-fix notation, which is "{operator} {operator}{var}" and "{var}{operator} {operator}", respectively. For example:
int x = 0;
x += 1; // assignment, x = 1
++x; // pre-fix notation, x = 2
x++; // post-fix notation, x = 3
...however, you should know and understand pre- and post-fix notation, and how they work - because they can both be useful tools, even if they aren't necessarily as easy to understand. For instance, compare this example:
int i = 0;
while (i++ < 2) {
serial.println(i);
}
...vs...
int i = 0;
while (++i < 2) {
serial.println(i);
}
When you understand why these example don't give the same results, you will hopefully understand how pre- and post-fix notation can be useful...