Skip to content

Commit

Permalink
Add documentation for GDScript when statement
Browse files Browse the repository at this point in the history
  • Loading branch information
tetrapod00 committed Aug 20, 2024
1 parent 5dd72ba commit 0901677
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tutorials/scripting/gdscript/gdscript_basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ in case you want to take a look under the hood.
+------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| as | Cast the value to a given type if possible. |
+------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| when | Used by :ref:`pattern guard expressions<doc_gdscript_basics_pattern_guards>` in match_ statements. |
+------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| self | Refers to current class instance. |
+------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| super | Resolves the scope of the parent method. See `Inheritance`_. |
Expand Down Expand Up @@ -1787,8 +1789,10 @@ The following pattern types are available:
"Sword", "Splash potion", "Fist":
print("Yep, you've taken damage")

Pattern guards
""""""""""""""
.. _doc_gdscript_basics_pattern_guards:

Pattern guard expressions
"""""""""""""""""""""""""

Only one branch can be executed per ``match``. Once a branch is chosen, the rest are not checked.
If you want to use the same pattern for multiple branches or to prevent choosing a branch with too general pattern,
Expand Down

0 comments on commit 0901677

Please sign in to comment.