From 795df857cb3b612cc5ff01ff0827dfd2daf8b2e1 Mon Sep 17 00:00:00 2001 From: TheYellowArchitect Date: Sun, 10 Dec 2023 10:01:41 +0000 Subject: [PATCH] Added enum iteration example --- tutorials/scripting/gdscript/gdscript_basics.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tutorials/scripting/gdscript/gdscript_basics.rst b/tutorials/scripting/gdscript/gdscript_basics.rst index 78ce590cac5..b48ca8c9f29 100644 --- a/tutorials/scripting/gdscript/gdscript_basics.rst +++ b/tutorials/scripting/gdscript/gdscript_basics.rst @@ -1231,6 +1231,7 @@ a dictionary can also be used with a named enum. # Is the same as: const State = {STATE_IDLE = 0, STATE_JUMP = 5, STATE_SHOOT = 6} + # Access values with State.STATE_IDLE, etc. func _ready(): # Access values with Name.KEY, prints '5' @@ -1238,6 +1239,10 @@ a dictionary can also be used with a named enum. # Use constant dictionary functions # prints '["STATE_IDLE", "STATE_JUMP", "STATE_SHOOT"]' print(State.keys()) + # prints '["STATE_IDLE", "STATE_JUMP", "STATE_SHOOT"]' + print(State) + # prints '[0, 5, 6]' + print(State.values()) Functions