Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Mark Sriskulpinyo
1,492 PointsWhat are the differences between the while and for-in loop? Can one of these be used instead of another?
The difference between these two loops
1 Answer
Sage Elliott
30,003 PointsHere is a good little read on StackOverflow.
"The main difference between the for's and the while's is a matter of pragmatics: we usually use for when there is a known number of iterations, and use while constructs when the number of iterations in not known in advance. The while vs do ... while issue is also of pragmatics, the second executes the instructions once at start, and afterwards it behaves just like the simple while."
check out the code samples hopefully that will help you!
http://stackoverflow.com/questions/2950931/for-vs-while-in-c-programming