+ 2

I dont know why we have do...while loop? We can easily executive a statement by some code one which do does ..then y need of do?

25th Jul 2017, 6:02 PM
Yasir Faiz Ahmed
Yasir Faiz Ahmed - avatar
3 Respuestas
+ 1
When we need to do some repetitive task we can use loops instead of writing the same code again n no.of times. Especially when you don't know how many times you need to execute the same code, you can use while loop. For example, you need to print the no.of words in a sentence. You don't know how lengthy the sentence would be. In such cases you can use while loop.
25th Jul 2017, 6:25 PM
Swathipriya
Swathipriya - avatar
+ 1
No idea what your second sentence is about so I'm just gonna ignore it. The do while loop is used when you want something to be executed at least once. One thing I use a do while loop for often is for when I want to generate 2 random numbers but I don't want the 2 numbers to be the same. I always want it to be done at least once and then repeat if necessary.
25th Jul 2017, 6:26 PM
Dennis
Dennis - avatar
0
hi. I'm new but my name is Ayo Im using my mom's email could u help me understand c# well
5th Sep 2017, 9:15 PM
Esther Fadumiye
Esther Fadumiye - avatar