The code you have will return the value then increment, or decrement. To perform the change before hand try:
It is not really thread safe, but it is such a trivial example that you won't see a problem.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DDEthel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
Last Visit: 31-Dec-99 18:00 Last Update: 26-May-16 13:01