While Loops in Swift

While loops perform a set of operations when a given condition is satisfied and continues to iterate till the condition becomes false. They are best used when the number of iterations are not known prior to the execution of first iteration.

Syntax :

while <condition> {

//Statements to be executed


Example :


Leave a Reply

%d bloggers like this: