From 014031046a1f2e0447811e08d32f62e944ed8dbf Mon Sep 17 00:00:00 2001 From: Lexyth Date: Sun, 23 Mar 2025 11:08:24 +0100 Subject: [PATCH] Fix good/bad example order Moved the bad example below the good example to stay consistent with previous instances. --- .../scripting/gdscript/gdscript_styleguide.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tutorials/scripting/gdscript/gdscript_styleguide.rst b/tutorials/scripting/gdscript/gdscript_styleguide.rst index 60d5f2d8a..d7d5bf031 100644 --- a/tutorials/scripting/gdscript/gdscript_styleguide.rst +++ b/tutorials/scripting/gdscript/gdscript_styleguide.rst @@ -1032,6 +1032,14 @@ the function's return type. For example, ``get_node()`` cannot infer a type unless the scene or file of the node is loaded in memory. In this case, you should set the type explicitly. +**Good**: + +.. rst-class:: code-example-good + +:: + + @onready var health_bar: ProgressBar = get_node("UI/LifeBar") + **Bad**: .. rst-class:: code-example-bad @@ -1042,17 +1050,11 @@ should set the type explicitly. # instead of ProgressBar. @onready var health_bar := get_node("UI/LifeBar") -**Good**: - -.. rst-class:: code-example-good - -:: - - @onready var health_bar: ProgressBar = get_node("UI/LifeBar") - Alternatively, you can use the ``as`` keyword to cast the return type, and that type will be used to infer the type of the var. +**Good**: + .. rst-class:: code-example-good ::