浏览代码

for statement iterating through String characters

(cherry picked from commit f7cfd22af4a9bd22d7d4c85236a0882998a4a31f)
Pawel Kowal 8 年之前
父节点
当前提交
5ca1e43cd6
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      reference/gdscript.rst

+ 3 - 0
reference/gdscript.rst

@@ -650,6 +650,9 @@ in the loop variable.
     for i in range(2,8,2):
     for i in range(2,8,2):
         statement  # similar to [2, 4, 6] but does not allocate an array
         statement  # similar to [2, 4, 6] but does not allocate an array
 
 
+    for c in "Hello":
+        print(c)   # iterate through all characters in a String, print every letter on new line
+
 Classes
 Classes
 ~~~~~~~
 ~~~~~~~