0

While loop and for loop

when should we use (For loop, While loop and Do..while loop)

22nd Aug 2016, 5:02 AM
Zafirah Mohamed iqbal
Zafirah Mohamed iqbal - avatar
2 Réponses
0
Use for statement for processing stuff like lists and use while for something that has to repeat a lot
22nd Aug 2016, 7:47 AM
Dogcatfee
Dogcatfee - avatar
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.
22nd Aug 2016, 9:56 AM
Programmer