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

14y 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.


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.


How do while loops terminate?

When the while-condition first becomes false.


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.


What is the difference between dynamic equivalence and formal equivalence?

Dynamic equivalence and formal equivalence are two approaches to translation. Dynamic equivalence focuses on conveying the meaning and intent of the original text in a way that resonates with the target audience, prioritizing comprehension over literal accuracy. In contrast, formal equivalence emphasizes a word-for-word translation, maintaining the original structure and phrasing as closely as possible, even if it makes the text less accessible. Essentially, dynamic equivalence seeks to capture the spirit of the text, while formal equivalence aims for fidelity to the original wording.


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.