The while loop is used to repeat its block of commands a number of times. It is different from for loop, it iterates until the while condition is no longer true.