increase and decrease - jpbubble/NIL-isn-t-Lua GitHub Wiki
++ and --
They work similar as in C and languages based on the same syntax
int a = 20
a++
++a
a++
print(a) // Outputs 23
And yes, you can also do this with --
int a = 20
a--
--a
a--
print(a) // Outputs 17
There are a few rubs though. Unlike C, you cannot put these anywhere you want. NIL will require the entire line to be used for nothing but the ++ or -- setup And even more importantly DON'T PUT COMMENTS IN THESE LINES OR YOUR TRANSLATION WILL BE MESSED UP!
So if you still need to increment in the middle of a line, you'll still have to rely on the classic "a = a + 1" kind of syntax.
=== NOTE: There is no variant to += or -= or stuff like that. I am still investigating if I can do that, though.