Skip to content

Commit

Permalink
Add pow operator to GDScript operators list
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosus committed May 12, 2022
1 parent 7dd8c7f commit ef2c777
Showing 1 changed file with 59 additions and 53 deletions.
112 changes: 59 additions & 53 deletions tutorials/scripting/gdscript/gdscript_basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,59 +219,65 @@ Operators

The following is the list of supported operators and their precedence.

+------------------------------------------------------------------------+-----------------------------------------+
| **Operator** | **Description** |
+------------------------------------------------------------------------+-----------------------------------------+
| ``x[index]`` | Subscription (highest priority) |
+------------------------------------------------------------------------+-----------------------------------------+
| ``x.attribute`` | Attribute reference |
+------------------------------------------------------------------------+-----------------------------------------+
| ``foo()`` | Function call |
+------------------------------------------------------------------------+-----------------------------------------+
| ``is`` | Instance type checker |
+------------------------------------------------------------------------+-----------------------------------------+
| ``~`` | Bitwise NOT |
+------------------------------------------------------------------------+-----------------------------------------+
| ``-x`` | Negative / Unary negation |
+------------------------------------------------------------------------+-----------------------------------------+
| ``*`` ``/`` ``%`` | Multiplication / Division / Remainder |
| | |
| | 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), |
| | and is additionally used for Format |
| | Strings |
+------------------------------------------------------------------------+-----------------------------------------+
| ``+`` | Addition / Concatenation of arrays |
+------------------------------------------------------------------------+-----------------------------------------+
| ``-`` | Subtraction |
+------------------------------------------------------------------------+-----------------------------------------+
| ``<<`` ``>>`` | Bit shifting |
+------------------------------------------------------------------------+-----------------------------------------+
| ``&`` | Bitwise AND |
+------------------------------------------------------------------------+-----------------------------------------+
| ``^`` | Bitwise XOR |
+------------------------------------------------------------------------+-----------------------------------------+
| ``|`` | Bitwise OR |
+------------------------------------------------------------------------+-----------------------------------------+
| ``<`` ``>`` ``==`` ``!=`` ``>=`` ``<=`` | Comparisons |
+------------------------------------------------------------------------+-----------------------------------------+
| ``in`` | Content test |
+------------------------------------------------------------------------+-----------------------------------------+
| ``not`` | Boolean NOT |
+------------------------------------------------------------------------+-----------------------------------------+
| ``and`` | Boolean AND |
+------------------------------------------------------------------------+-----------------------------------------+
| ``or`` | Boolean OR |
+------------------------------------------------------------------------+-----------------------------------------+
| ``if x else`` | Ternary if/else |
+------------------------------------------------------------------------+-----------------------------------------+
| ``as`` | Type casting |
+------------------------------------------------------------------------+-----------------------------------------+
| ``=`` ``+=`` ``-=`` ``*=`` ``/=`` ``%=`` ``&=`` ``|=`` ``<<=`` ``>>=`` | Assignment (lowest priority) |
+------------------------------------------------------------------------+-----------------------------------------+
+--------------------------------------------------------------------------------+-------------------------------------------+
| **Operator** | **Description** |
+================================================================================+===========================================+
| ``x[index]`` | Subscription (highest priority) |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``x.attribute`` | Attribute reference |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``foo()`` | Function call |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``is`` | Instance type checker |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``~`` | Bitwise NOT |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``**`` | Power operator |
| | |
| | Multiplies value by itself ``x`` times, |
| | similar to calling ``pow`` built-in |
| | function |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``-x`` | Negative / Unary negation |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``*`` ``/`` ``%`` | Multiplication / Division / Remainder |
| | |
| | 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), |
| | and is additionally used for Format |
| | Strings |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``+`` | Addition / Concatenation of arrays |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``-`` | Subtraction |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``<<`` ``>>`` | Bit shifting |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``&`` | Bitwise AND |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``^`` | Bitwise XOR |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``|`` | Bitwise OR |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``<`` ``>`` ``==`` ``!=`` ``>=`` ``<=`` | Comparisons |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``in`` | Content test |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``not`` | Boolean NOT |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``and`` | Boolean AND |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``or`` | Boolean OR |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``if x else`` | Ternary if/else |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``as`` | Type casting |
+--------------------------------------------------------------------------------+-------------------------------------------+
| ``=`` ``+=`` ``-=`` ``*=`` ``/=`` ``%=`` ``**=`` ``&=`` ``|=`` ``<<=`` ``>>=`` | Assignment (lowest priority) |
+--------------------------------------------------------------------------------+-------------------------------------------+

Literals
~~~~~~~~
Expand Down

0 comments on commit ef2c777

Please sign in to comment.