4. Condition Control Iteration (While Loop)

Iteration

We saw in the last section that Iteration are used in programming when you want something to happen repetitively.

Using loops makes your code more efficient.

it is better than writing out the same lines over and over..


While Loops

A While Loop is used to repeat something whilst a certain condition is met.

The code below shows a basic example of a While Loop

The example below shows another example of a while loop for a program that keeps asking the user to enter the password until it is entered correctly.

The following shows the output of the same program when interacted with by a user: