Merge pull request #4327 from zacryol/gdscript-int-loop

[GDScript/en] add example of iterating over an int with `for`
This commit is contained in:
Marcel Ribeiro Dantas, Ph.D 2022-07-31 18:40:27 +02:00 committed by GitHub
commit 46358c59e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)