-
Notifications
You must be signed in to change notification settings - Fork 2
Operators
mystborn edited this page Mar 6, 2018
·
2 revisions
TaffyScript supports a number of operators:
| Operator | Operation |
|---|---|
| + | Addition |
| - | Subtraction |
| * | Multiplcation |
| / | Division |
| % | Modulus |
| ++ | Increment |
| -- | Decrement |
| Operator | Operation |
|---|---|
| == | Equal |
| != | Not Equal |
| < | Less Than |
| <= | Less Than or Equal |
| > | Greater Than |
| >= | Greater Than or Equal |
| Operator | Operation |
|---|---|
| and | And |
| or | Or |
| && | And |
| || | Or |
| ! | Not |
| Operator | Operation |
|---|---|
| ~ | Complement |
| & | Bitwise And |
| | | Bitwise Or |
| ^ | Xor |
| << | Shift Left |
| >> | Shift Right |
Note: Shifting right extends the sign. In other words, shifting a negative number right keeps the sign.
An equal sign has two meanings in TaffyScript. If it's the first expression in a statement or used in comma seperated list of local declarations, it will assign a value to a variable. Any time after that, it will act the same as ==. This behavior is quite silly, but is implemented to increase backwards compatibility with Gamemaker. (This could be subject to change if there is sufficient demand).