LSL Wiki Mirror 10-5-2006: Unary

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::

Unary

Unary arithmetic operators take one argument, usually of integer type, and change the its value as a side-effect.

Operator Meaning Value of Statement Effect
variable++ post-increment variable variable is set to variable + 1
++variable pre-increment variable + 1 variable is set to variable + 1
variable-- post-decrement variable variable is set to variable - 1
--variable pre-decrement variable - 1 variable is set to variable - 1

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

Other types of operators:
assignment, binary, bitwise, boolean


Operators
There are 6 comments on this page. [Display comments/form]