Can somebody please help me understand the loop functions
I am just trying to create a simple loop
for a = 1 to 10
print a
next
Have looked in the forum but I am none the wiser
have attached the .capx file, and any help appreciated
Thanks
You are repeating the loop infinitely, since you added no other condition. If you want the loop to happen once every 1 second, the loop MUST be nested under the Every 1 seconds event. In this case the variable will increase 10 every 1 second.
Develop games in your browser. Powerful, performant & highly capable.
Bruno thanks for the reply, yes sorry my mistake, but why does it increment by 10 when I do as you suggested.
Do for loops not work the same as in for example Python, where from my above code the loop would count from 1 to 10, using the loop as the counter?
Maybe you want to counting from 1 to 10? Then this is what I did:
Because you add 1 every loop iteration. The loop has 10 of those iterations every second, thus, every second it adds 1 to the the variable 10 times. That's why it goes in increments of 10.
Many thanks to you both, I now have a little better idea about loops. Now just to experiment with them!!