Tag: or

S3 – Conditional Loops

A conditional loop is used to repeat part of the program until a condition is true.

The program shown here is a password checker. The program will exit the loop if the user guess is 1233 or the user has had 3 attempts. This uses a  complex conditional  statement with the logical operator OR, the OR logical operator returns a true value when one of the conditions are true.

The final IF statement checks if the user has entered the correct password before saying welcome.