mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
[GDScript/en] add example of iterating over an int with for
This commit is contained in:
parent
2f05725cc0
commit
6a600f7120
@ -114,6 +114,9 @@ func control_flow():
|
|||||||
for i in range(20): # GDScript's range is similar to Python's
|
for i in range(20): # GDScript's range is similar to Python's
|
||||||
print(i) # so this will print numbers from 0 to 19
|
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
|
for i in ["two", 3, 1.0]: # iterating over an array
|
||||||
print(i)
|
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)
|
* [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)
|
* [Signals](https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html)
|
||||||
* [GDQuest](https://www.gdquest.com/)
|
* [GDQuest](https://www.gdquest.com/)
|
||||||
* [GDScript.com](https://gdscript.com/)
|
* [GDScript.com](https://gdscript.com/)
|
||||||
|
Loading…
Reference in New Issue
Block a user