0

Where is the difference between a for and a while loop?

i tested it and so far I can see that the for loop is starting with the given value and the while loop is incrementing by one and then outputting it. Please excuse if this should be clear by now

17th Jul 2016, 5:23 PM
William Phillip
William Phillip - avatar
2 Answers
+ 1
in certain case when you use while, you dont know when the loop will stop, you only know, that if the condition turns false, it has to stop. with for loop you know exactly how many times it will execute. i hope it helps
27th Aug 2016, 8:40 AM
Benedek Måté Tóth
Benedek Måté Tóth - avatar
0
@Benedek Måté Tóth it does indeed make it clearer. Thanks a million
27th Aug 2016, 9:48 AM
William Phillip
William Phillip - avatar