Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | usurun |
How do I make a for such as in C#, and it just runs once?
for (int = 0; i > 20; i++)
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | usurun |
How do I make a for such as in C#, and it just runs once?
for (int = 0; i > 20; i++)
Reply From: | usurun |
Answer is:
for i in 20: pass
or
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)
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