What are a while loops and how do they function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What are a while loops and how do they function

19th Sep 2021, 5:14 PM
Nouman Ashraf
4 Answers
+ 1
While the loop, is already defined functions in programming. It works until that the wanted givens are not acceptable. Happy coding!
19th Sep 2021, 5:20 PM
mesarthim
mesarthim - avatar
+ 1
While loops can be used when we don't know how many iterations required. Which is dependent on some conditions or parameters which will be modified inside the block of code. #Java snippet.. int i = 0; while(I < 5){ ......... i = i + 2; }
19th Sep 2021, 5:26 PM
Parith (Faree)
Parith (Faree) - avatar
0
What are iteration
19th Sep 2021, 5:27 PM
Nouman Ashraf
0
Iterations are repetition of a process. If u know how many times iterations then use 'FOR' loop. #while loops ex: Sum of numbers from 0 to N. which is the max number when sum is equal or crossing 100. Find N. In this case start iteration from 1, 2,3....
19th Sep 2021, 5:33 PM
Parith (Faree)
Parith (Faree) - avatar