GDscript C# for?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By usurun

How do I make a for such as in C#, and it just runs once?

for (int = 0; i > 20; i++)
:bust_in_silhouette: Reply From: usurun

Answer is:

for i in 20: pass


for i in range(20): pass

Check out the basics. Or if you prefer watching a video.

Dlean Jeans | 2019-06-11 01:13

I don’t thinkfor i in 20 works. I’m pretty sure it’s for i in range (20).
Also, you don’t need var i = 0.

Dlean Jeans | 2019-06-11 02:28

for i in 20 does work, it’s equivalent to for i in range(20) :slight_smile:

Likewise, you can iterate on a string: for character in "hello"

Calinou | 2019-06-11 15:56

It does? Wow. I never knew after all these years.

Dlean Jeans | 2019-06-11 16:21