diff --git a/tutorials/scripting/gdscript/gdscript_basics.rst b/tutorials/scripting/gdscript/gdscript_basics.rst index 0f1451799d47..3c155146e706 100644 --- a/tutorials/scripting/gdscript/gdscript_basics.rst +++ b/tutorials/scripting/gdscript/gdscript_basics.rst @@ -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` in :ref:`match` statements. | ++------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ | self | Refers to current class instance. | +------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ | super | Resolves the scope of the parent method. See `Inheritance`_. | @@ -1638,6 +1640,9 @@ be manipulated by calling methods on the loop variable. for node in node_array: node.add_to_group("Cool_Group") # This has an effect + +.. _doc_gdscript_basics_match: + match ^^^^^ @@ -1787,8 +1792,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,