Check sibling questions

Differentiate between for loop and while loop?



For loop

While loop

The for statement is used to iterate over a range of values or a sequence .

The while statement executes a block of code repeatedly as long as the control condition of the loop is true. 

It is called a definite loop.

It is called an indefinite loop.


Flowchart of for loop - Teachoo.jpg


Flowchart of while loop - Teachoo.jpg

Learn in your speed, with individual attention - Teachoo Maths 1-on-1 Class

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 13 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.