> Tutorial
Operators are used to perform mathematical calculations or data manipulations of all kinds.
Here are the main operators:
+: Addition of two numbers-: Subtraction*: Multiplication/: Division (decimal result)//: Quotient of integer division%: Remainder of the division (modulo)==: Equality between two values, =`: Comparisons of two numbersand: "And" of two booleansor: "Or" of two booleansnot: "Not" (inverts a boolean)=: Assignment of a variable+=, -=, *= etc.: Operator + assignment of a variableFor an expression with multiple operators, the operators are applied with natural precedence, as * takes precedence over +.
Example with different operators:
It is also possible to use parentheses like: (5 + 7) * 2.
In addition to the = operator, there are many assignment operators like +=, -=, *= etc. which combine a calculation and an assignment.
An example with *=, which performs a multiplication and stores the result in the same variable:
Our current healing condition makes us heal as soon as we have lost 1 life point. We can improve it by healing ourselves only if our life is
To display the value of a variable or an expression in combat actions, use Debug.log(). Example: Debug.log(me.maxLife * 0.75).
What is the result of the code 10 + (5 * 7) - 20 // 4?
40 25 18 -30
What is the value of x at the end of the code x = 10 x *= 2 x += 5 x //= 5?
5 15 22 12
What is the result of the code (True and False) or (True and True)?
1 3 True False
Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.