The while Loop

This lesson highlights the key features of the 'while' loop.

The while loop keeps iterating over a certain set of operations as long as a certain condition holds True.

It operates using the following logic:

While this condition is true, keep the loop running.

Structure #

In a for loop, the number of iterations is fixed since we know the size of the sequence.

On the other hand, a while loop is not always restricted to a fixed range. Its execution is based solely on the condition associated with it.

Get hands-on with 1200+ tech skills courses.