++ / −−
Increment / decrement. Always emits += 1 / -= 1 (not a distinct prefix/postfix value).
Syntax
Section titled “Syntax”i++;++i;i--;Parameters
Section titled “Parameters”None.
Return value
Section titled “Return value”Used as a statement; the C++ value distinction is not preserved.
Luau emit
Section titled “Luau emit”i += 1 / i -= 1
Description
Section titled “Description”Typical in C-style for. Do not rely on x = i++ returning the old value.
Example
Section titled “Example”for (int i = 0; i < 10; i++) { post(i);}Emits:
local i = 0while i < 10 do print(i) i += 1end