2
0
Эх сурвалжийг харах

Fix good/bad example order

Moved the bad example below the good example to stay consistent with previous instances.
Lexyth 4 сар өмнө
parent
commit
014031046a

+ 10 - 8
tutorials/scripting/gdscript/gdscript_styleguide.rst

@@ -1032,27 +1032,29 @@ 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
 unless the scene or file of the node is loaded in memory. In this case, you
 should set the type explicitly.
 should set the type explicitly.
 
 
-**Bad**:
+**Good**:
 
 
-.. rst-class:: code-example-bad
+.. rst-class:: code-example-good
 
 
 ::
 ::
 
 
-    # The compiler can't infer the exact type and will use Node
-    # instead of ProgressBar.
-    @onready var health_bar := get_node("UI/LifeBar")
+    @onready var health_bar: ProgressBar = get_node("UI/LifeBar")
 
 
-**Good**:
+**Bad**:
 
 
-.. rst-class:: code-example-good
+.. rst-class:: code-example-bad
 
 
 ::
 ::
 
 
-    @onready var health_bar: ProgressBar = get_node("UI/LifeBar")
+    # The compiler can't infer the exact type and will use Node
+    # instead of ProgressBar.
+    @onready var health_bar := get_node("UI/LifeBar")
 
 
 Alternatively, you can use the ``as`` keyword to cast the return type, and
 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.
 that type will be used to infer the type of the var.
 
 
+**Good**:
+
 .. rst-class:: code-example-good
 .. rst-class:: code-example-good
 
 
 ::
 ::