programming | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

programming

Which of the two loops: while loop and for loop is most used in applications development?

6th Jun 2019, 10:43 AM
Walter Mukaro
Walter Mukaro - avatar
3 Answers
+ 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
6th Jun 2019, 11:24 AM
Cat Sauce
Cat Sauce - avatar
0
for loops for sure you only use while loops for infinite loops
6th Jun 2019, 10:58 AM
Cat Sauce
Cat Sauce - avatar
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
6th Jun 2019, 11:12 AM
Mo Hani
Mo Hani - avatar