Skip to content

++ / −−

Operator

Increment / decrement. Always emits += 1 / -= 1 (not a distinct prefix/postfix value).

i++;
++i;
i--;

None.

Used as a statement; the C++ value distinction is not preserved.

i += 1 / i -= 1

Typical in C-style for. Do not rely on x = i++ returning the old value.

for (int i = 0; i < 10; i++) {
post(i);
}

Emits:

local i = 0
while i < 10 do
print(i)
i += 1
end

for · operator-assignment