Unary operators take one argument. In LSL these arguments are normally integers.
Operator | Type | Meaning | Return Value | Effect |
variable++ | Arithmetic | post-increment | variable | variable is set to variable + 1 |
++variable | Arithmetic | pre-increment | variable + 1 | variable is set to variable + 1 |
variable– | Arithmetic | post-decrement | variable | variable is set to variable – 1 |
–variable | Arithmetic | pre-decrement | variable – 1 | variable is set to variable – 1 |
!variable | Logical | Logical NOT | 1 if variable is 0, otherwise 0 | None |
-variable | Arithmetic | Unary negation | negative value of variable | None |
~variable | Bitwise | Bitwise NOT | flips each bit of variable | None |
Examples:
integer x = 5; llSay(0, (string)(x++)); //Says "5" and x is set to 6
integer x = 5; llSay(0, (string)(++x)); //Says "6" and x is set to 6
Credit to: Lslwiki.net (not working) with changes made for brevity and clarity.