Skip to content

Operators

mystborn edited this page Mar 6, 2018 · 2 revisions

TaffyScript supports a number of operators:

Arithmetic

Operator Operation
+ Addition
- Subtraction
* Multiplcation
/ Division
% Modulus
++ Increment
-- Decrement

Comparison

Operator Operation
== Equal
!= Not Equal
< Less Than
<= Less Than or Equal
> Greater Than
>= Greater Than or Equal

Boolean

Operator Operation
and And
or Or
&& And
|| Or
! Not

Bitwise

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.

Assignment

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).

Clone this wiki locally