+ 3
Difference between for loop, while loop and do while loop.
difference between 3 loops
1 Answer
+ 6
The main difference between for loop, while loop, and do while loop is
While loop checks for the condition first. so it may not even enter into the loop, if the condition is false.
do while loop, execute the statements in the loop first before checks for the condition. At least one iteration takes places, even if the condition is false.
for loop is similar to while loop except that initialization statement, usually the counter variable initialization statement that will be executed after each and every iteration in the loop, usually counter variable increment or decrement