Do-while Loop

  • In real-life programming,if there comes a situation when it is not known how many times the statements in the loop are to be executed.In this situation,we use do-while loop.

  • The loop is executed at least once whether the condition is true or false

  • The general form of do-while loop is:


do this;

and this;

and this;


  • If you pass 1 as an expression in a do-while loop it will run an infinite number of times.