0 votes

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

for (int = 0; i > 20; i++)
in Engine by (334 points)
edited by

1 Answer

0 votes
Best answer

Answer is:

for i in 20: pass

or

for i in range(20): pass
by (334 points)
edited by

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

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.

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

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

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.