Ver código fonte

Simplify mul/div/remainder operator text

IMO this is a much better description. It's to the point, and if anyone has further questions, they can look up how the C++ operators work.
Aaron Franke 6 anos atrás
pai
commit
35235a1d28

+ 5 - 10
getting_started/scripting/gdscript/gdscript_basics.rst

@@ -264,16 +264,11 @@ The following is the list of supported operators and their precedence.
 +---------------------------------------------------------------+-----------------------------------------+
 +---------------------------------------------------------------+-----------------------------------------+
 | ``*`` ``/`` ``%``                                             | Multiplication / Division / Remainder   |
 | ``*`` ``/`` ``%``                                             | Multiplication / Division / Remainder   |
 |                                                               |                                         |
 |                                                               |                                         |
-|                                                               | NOTE: The result of these operations    |
-|                                                               | depends on the operands types. If both  |
-|                                                               | are Integers, then the result will be   |
-|                                                               | an Integer. That means 1/10 returns 0   |
-|                                                               | instead of 0.1. If at least one of the  |
-|                                                               | operands is a float, then the result is |
-|                                                               | a float: float(1)/10 or 1.0/10 return   |
-|                                                               | both 0.1.                               |
-|                                                               | NOTE2: Remainder/Modulo only works on   |
-|                                                               | int. For floats use built in fmod()     |
+|                                                               | These operators have the same behavior  |
+|                                                               | as C++. Integer division is truncated   |
+|                                                               | rather than returning a fractional      |
+|                                                               | number, and the % operator is only      |
+|                                                               | available for ints ("fmod" for floats)  |
 +---------------------------------------------------------------+-----------------------------------------+
 +---------------------------------------------------------------+-----------------------------------------+
 | ``+``                                                         | Addition / Concatenation of Arrays      |
 | ``+``                                                         | Addition / Concatenation of Arrays      |
 +---------------------------------------------------------------+-----------------------------------------+
 +---------------------------------------------------------------+-----------------------------------------+