瀏覽代碼

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

Dan Boorstein 6 年之前
父節點
當前提交
b4fb258356
共有 1 個文件被更改,包括 6 次插入0 次删除
  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":
     for c in "Hello":
         print(c) # Iterate through all characters in a String, print every letter on new line.
         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
 match
 ^^^^^
 ^^^^^