0

How is the for loop diff from the while loop

not considering syntax

5th Mar 2018, 4:59 PM
ADAMS MOHAMMED
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.
5th Mar 2018, 5:07 PM
LordHill
LordHill - avatar
+ 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.
5th Mar 2018, 5:07 PM
emmey
emmey - avatar
0
thanks guys
6th Mar 2018, 6:26 PM
ADAMS MOHAMMED