Loading topic
while loop repeats that code for as long as a test is true. It is useful when you want to keep working until something changes, such as a count reaching a limit or a total reaching a goal.3 min readdo-while loop runs those statements first, then checks whether to repeat them. This order matters: the loop runs its body at least once, even if its condition is false at the start.3 min readfor loop repeats instructions while a condition is true. It is useful when you know how a count should start, when it should stop, and how it should change each time.3 min read