What is the function of while loop?

What is the function of while loop?
Answer
The while loop is used
to repeat a section of code an unknown number of times until a specific condition is met
. For example, say we want to know how many times a given number can be divided by 2 before it is less than or equal to 1.
 

Tìm kiếm

Back
Top