07-24-2023, 10:11 AM
> **Possible Duplicates:** <br/>
> [While vs. Do While](
> [When should I use do-while instead of while loops?](
<!-- End of automatically inserted text -->
I've been programming for a while now (2 years work + 4.5 years degree + 1 year pre-college), and I've never used a do-while loop short of being forced to in the Introduction to Programming course. I have a growing feeling that I'm doing programming wrong if I never run into something so fundamental.
Could it be that I just haven't run into the correct circumstances?
What are some examples where it would be necessary to use a do-while instead of a while?
(My schooling was almost all in C/C++ and my work is in C#, so if there is another language where it absolutely makes sense because do-whiles work differently, then these questions don't really apply.)
To clarify...I know the difference between a `while` and a `do-while`. While checks the exit condition and then performs tasks. `do-while` performs tasks and then checks exit condition.
> [While vs. Do While](
[To see links please register here]
) <br/>> [When should I use do-while instead of while loops?](
[To see links please register here]
)<!-- End of automatically inserted text -->
I've been programming for a while now (2 years work + 4.5 years degree + 1 year pre-college), and I've never used a do-while loop short of being forced to in the Introduction to Programming course. I have a growing feeling that I'm doing programming wrong if I never run into something so fundamental.
Could it be that I just haven't run into the correct circumstances?
What are some examples where it would be necessary to use a do-while instead of a while?
(My schooling was almost all in C/C++ and my work is in C#, so if there is another language where it absolutely makes sense because do-whiles work differently, then these questions don't really apply.)
To clarify...I know the difference between a `while` and a `do-while`. While checks the exit condition and then performs tasks. `do-while` performs tasks and then checks exit condition.