Phantom
Documentation [Help Home] [Phantom Home] |
Math Operations
|
Mathematical operations can be
performed in Phantom. + - addition Each variable type can also override the functionality of an operator. For example, a + operator between two strings will concatenate them. Refer to the documentation for a variable if unsure of an operator's purpose. Additionally, not all variable types support all operators. To see if an operator is supported by a variable type, see Variables.
Additionally, the following math operations are supported:
++ - Increment: increments the variable by one If the increment or decrement operator is placed before the variable, the operation is performed before the variable is used. If it is placed after the variable, the operation is performed after the variable is used.
Order of Precedence Math operators follow an order of precedence if they are applied consecutively. The order of precedence is as follows, with the first operators being performed first. 1. ^ 2. */ 3. +- 4. = If two operators have the same priority, the precedence is from left to right. Additionally, any statement in parentheses is automatically moved to the top of the precedence order.
Compatibility
Between real and int real
r = 1/3*4; #r=0.0 There are also many mathematical functions. For a list, see the standard functions. For more information on various operators, see the Operators section. See Also: Variables
|