0
programming
Which of the two loops: while loop and for loop is most used in applications development?
3 odpowiedzi
+ 1
Mo Hani Thats true, i didnt use the correct words
while loops are mostly used when there is a boolean like for example (GameIsRunning) and you need the code to run while the game is running
thats what i meant with infinit loops...
but i stikl think for loops are more used because you can specify the where us begins, where it ends and whith how big steps it leaps
in a for loop you can also just with other variable like:
int b = 0;
for (;b < a ;b++){
//do stuff
}
you can use other variables really easy
0
for loops for sure
you only use while loops for infinite loops
0
Both are vital and used frequently.
Olin Guerrero i'll disagree wih you, while loop aren't always 'infinite loops' it's called a while loop because it runs statements while it's true and stop when it's false