Sfoglia il codice sorgente

Document 'for' treatment of a bare number as a 'range()'

Dan Boorstein 6 anni fa
parent
commit
b4fb258356
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  1. 6 0
      getting_started/scripting/gdscript/gdscript_basics.rst

+ 6 - 0
getting_started/scripting/gdscript/gdscript_basics.rst

@@ -842,6 +842,12 @@ in the loop variable.
     for c in "Hello":
         print(c) # Iterate through all characters in a String, print every letter on new line.
 
+    for i in 3:
+        statement # Similar to range(3)
+
+    for i in 2.2:
+        statement # Similar to range(ceil(2.2))
+
 match
 ^^^^^