summaryrefslogtreecommitdiffhomepage
path: root/gdscript.html.markdown
diff options
context:
space:
mode:
authorMarcel Ribeiro Dantas, Ph.D <ribeirodantasdm@gmail.com>2022-07-31 18:40:27 +0200
committerGitHub <noreply@github.com>2022-07-31 18:40:27 +0200
commit46358c59e999e193bccd41b46688becc0b40e5fa (patch)
treecc96a8bbb4a572fd9f6a998931b58f04a449b9ff /gdscript.html.markdown
parent9852ea8856e527a078345b346f25eaaf88f1e14f (diff)
parent6a600f71202e52bdc2553f56c963edcf6014414f (diff)
Merge pull request #4327 from zacryol/gdscript-int-loop
[GDScript/en] add example of iterating over an int with `for`
Diffstat (limited to 'gdscript.html.markdown')
-rw-r--r--gdscript.html.markdown5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdscript.html.markdown b/gdscript.html.markdown
index 25af0974..93f49ba6 100644
--- a/gdscript.html.markdown
+++ b/gdscript.html.markdown
@@ -114,6 +114,9 @@ func control_flow():
for i in range(20): # GDScript's range is similar to Python's
print(i) # so this will print numbers from 0 to 19
+ for i in 20: # unlike Python, you can loop over an int directly
+ print(i) # so this will also print numbers from 0 to 19
+
for i in ["two", 3, 1.0]: # iterating over an array
print(i)
@@ -319,4 +322,4 @@ signal example(arg: int) # ERROR! Signals can't take typed arguments!
* [NodePath](https://docs.godotengine.org/en/stable/classes/class_nodepath.html)
* [Signals](https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html)
* [GDQuest](https://www.gdquest.com/)
-* [GDScript.com](https://gdscript.com/) \ No newline at end of file
+* [GDScript.com](https://gdscript.com/)