Friday 22 July 2016

DIFFERENCE BETWEEN FOR LOOP AND WHILE LOOP

DIFFERENCE BETWEEN FOR LOOP AND WHILE LOOP


FOR LOOP:


For Loops run through the loop when you know how many times you'd like it to run through the problem such as for (int b=1; b < 11; b++); this will continually increases it untill that condition returns false, any number can replace the 11 even a variable. but it will quit once the condition is no longer being met. This is best used again for loops that you know how when they should stop.







While LOOP:


While Loops is little more flexability in what you puts in it, and when it will stop such as while ( b < 11) you can also substitued in a boolean(T/F) for 11 as well as many other types of varibles.















No comments:

Post a Comment