0
While loop and for loop
when should we use (For loop, While loop and Do..while loop)
2 Réponses
0
Use for statement for processing stuff like lists and use while for something that has to repeat a lot
0
As per for while and do...while , while is an entry control loop where it checks the condition first and then evaluates.
do...while is an exit control loop which executes atleast once even when the condition is false.
As per for loop , all the conditions inside it are optional . So if you want to make a program in which you do not want to specify the condition , for loop can be used.
Actually the use depends on the sotuation . If you are familiar with the loops , you can use any loop.