+ 2
Is it important to have conditions like "X++" and "<" in For loop ?
9 Respostas
+ 2
In while loop initialisation done before while loop, condition will be within ( ) and increment or decrement done in while loop
Where as for loop initialisation, condition and increment or decrement done in one line
in for loop increment or decrement can be done in for loop
For loop can be used as while loop
But while loop cannot be used as for loop
+ 2
No
It is not compulsory to use it in for loop
+ 2
Yes, my doubt is clear but then how is for loop more useful in coding ?
+ 1
Are for loop and while loop the same ?
+ 1
No
+ 1
What is the main difference ?
For loop and while loop needs to have one condition and other things like
"int X =" something or "X++" can be written inside the while loop and can be written inside the ( )- braces of for loop.....
+ 1
Both are useful for there specific application
Where for loop is more convenient because it is written in one line!!
+ 1
Ok , thanks for the help
0
Have you got your doubt clear