Swift while loop is used to run a specific code until a certain condition is met . The syntax of while loop is: while (condition){ // body of loop } Here, A while loop evaluates condition inside the parenthesis () . If condition evaluates to true , the code inside the while loop is executed.