0
How is the for loop diff from the while loop
not considering syntax
3 Antworten
+ 2
while loop runs until a condition is met. for example, game over.
for loop generally runs a set amount of times. for example, run 1 time for every item in a list/array. run 1 time per file in a directory. things like that.
+ 1
for loops can be setup to run a set number of times. while loop runs until a condition is met. How ever while loops can be used in place of any other loop but its never the best way. I have noticed while and do while loops used a lot in code for games.
0
thanks guys