The following operations are supported in SLUDGE:
A + B
If both values are numbers, the result is the total of the two numbers. If one value is not a number, the result is a string containing the string representation of the first value followed by the string representation of the second. For example, 1+2 is the number 3, whereas 1+"2" is the string "12".
A - B
Both values must be numbers. The result is the first number minus the second.
A * B
Both values must be numbers. The result is the first number multiplied by the second.
A / B
Both values must be numbers. The result is the first number divided by the second. The second number cannot be 0.
A % B
Both values must be numbers. The result is the remainder when the first number is divided by the second (or the modulus). The second number cannot be 0.
A && B
Both values are treated as boolean. The result is true if both values are TRUE, otherwise it is FALSE..
A || B
Both values are treated as boolean. The result is TRUE if either value is TRUE, otherwise it is FALSE.
A = B
Changes the value of A so that it now contains the same data as B. The same value is given as the result, meaning that the code A=B=C=D=E=8 will set all five variables to the numerical value 8.
A == B
The result is TRUE if both values are of the same type and if the contents match, otherwise it is FALSE.
A != B
The result is FALSE if both values are of the same type and if the contents match, otherwise it is TRUE.
A > B
Both values must be numbers. The result is TRUE if the first number is greater than the second, otherwise it is FALSE.
A < B
Both values must be numbers. The result is TRUE if the first number is less than the second, otherwise it is FALSE.
- A
The value must be a number. The result is 0 minus the original value.
! A
The value is treated as boolean. The result is FALSE if the value is TRUE, and TRUE if the value is FALSE.
A ? B : C
The first value is treated as boolean. The result is B if the value is TRUE and C if the value is FALSE.
A ++
Increases the value of A by 1. A must be a number; if not, the code has no effect. The return value is the old value of A.
A --
Decreases the value of A by 1. A must be a number; if not, the code has no effect. The return value is the old value of A.
A += B
Adds A to B and stores the result in A. *
A -= B
Takes B from A and stores the result in A. *
A *= B
Multiplies A and B and stores the result in A. *
A /= B
Divides A by B and stores the result in A. *
A %= B
Performs the operation A % B and stores the result in A. *
(For operations in which the value or values must be numbers, the engine will quit with a Fatal Error message box if non-numbers are used.)
Problems with +=, -=, *=, /= and %= in SLUDGE
Treating Variables as Booleans
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012