answersLogoWhite

0

The For loops and While loops are similar in functionality aspects. They perform a specified set of instructions repeatedly until a certain condition is met. The only difference being, the loop variable modification happens in the for loop declaration whereas in case of a while loop, we must include it in the block of code within the loop.

Ex:

For Loop:

for(int i=0; i<10;i++){

...

}

While Loop:

int i = 0;

while(i < 10){

i++

...

}

If you see the code the variable initialization, modification happens in the same line for a For loop whereas in case of a while loop we do it in separate lines of code.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Where do you get loop the loop straws?

C, for loops, while loops, and do while loops are control structures forFor example, the following programs are functionally identical: While loop


What is the fundamental difference between while loops and numeric for loops?

There is no such difference, for and while loops are convertible: in: for (exp1; exp2; exp3) stmt; out: { exp1; while (exp2) { stmt; exp3; }} in: while (exp) stmt; out: for (; exp; ) stmt;


Which java loops are entry controlled?

The for and while statements are entry-controlled loops. The do-while statement is an exit-controlled loop.


What is repetition control structure?

Repetitive control structures are loops like the do while loop and the for loops. They repeat and execute the same set of instruction until the condition stated in the while or for loop ceases to be true. After which it will exit the loop and continue down the program.


How do while loops terminate?

When the while-condition first becomes false.


What looping structures are there in JavaScript?

Loops in Java Script are:for - loops through a block of code a specified number of timeswhile - loops through a block of code while a specified condition is truedo...while - also loops through a block of code while a specified condition is truefor...in - loops through the properties of an objectFor more information, visit the Related Link.


Can you use two while loops in a program?

You can use zero or more while-loops, there is no limit.


What are the disadvantages of the While Loop?

With loops, your program is slower.


Is equivalence point PKa?

No, the equivalence point is not the same as pKa. The equivalence point is the point in a titration where the moles of acid are stoichiometrically equal to the moles of base, while pKa is a measure of the strength of an acid and its tendency to donate a proton.


How does C plus plus endeavor to represent the loop paradigm?

Iterative loops in C/C++ are represented by for(), while() and do...while() code blocks. Recursive loops are represented by functions calling themselves.


How do you do a nested loop using Qbasic?

There several methods: For/Next loop Do/While/Until loops You can have Do Loops within Do Loops.


Why do you use the loops in java?

You use loops in Java when you want a set of actions to be repeated until a particular condition is met or for a certain number of times.The different types of loops in Java are:For LoopsDo-While LoopsWhile Loops