Hello to everyone,
I am bit confused on the difference between for(determinate loop) and while loop(indeterminate loop)
what makes it different,as we convert for loop to while loop and vice-versa.
please give a example to clarify it.
Thank you
3 replies to this topic
#1
Posted 07 October 2010 - 12:31 PM
|
|
|
#2
Posted 08 October 2010 - 12:25 AM
the main difference is that you can convert any for loop into while but you cant always convert a while loop to a for or its not really worth doing that, that's what i think at least.
#3
Posted 08 October 2010 - 04:22 AM
Except, in C++ you can, because there is nothing that says a for loop has to be a simple increment.
#4
Posted 10 October 2010 - 08:37 AM
While loops are used when you're doing an unknown number of iterations and are instead waiting on some condition. For loops are used when you have a known number of iterations you need to do.
sudo rm -rf /
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









