answersLogoWhite

0


Best Answer

ditioFor loops are a little more complex then the While loop. A for loop as 3 optional parameters. They are the initializer list, the conditional check, and the post incrementer list.

The initializer list is the section that you declare variables and/or initialize them to a specific value.

The conditional check is the conditional check for the loop to continue or finish.

The post incrementer list is a section that is used to apply post loop code. Once each iteration of the loop is complete, these lines of code are called to update variables or conditions. Then the loop runs againns. Then the loop runs again

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

There are mainly 2 parts of a loop structure

1. Condition of termination

2. body of loop

Example of while loop:

while (condition_is_true){

body of loop;

}

Example of do-while loop:

do{

body of loop;

}while (condition_is_true);

Initialization is not part of loop structure.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the three parts that make up a loop structure?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you make a function repeat itself in C plus plus?

There are three ways to do repetitions in C as far as I know. The first is to use recursion (a function which calls itself) the second being a for loop and the third being a while loop, though both of these are basically the same thing. Here's a demonstration of using these three methods to compute the x raised to the power of y: (note this isn't the most efficient way of calculating the power of a number but it's good enough for an example) //Recursion: int pow(int base, int pwr){ if(pwr == 0){ return 1; }else{ return base * pow(base, pwr - 1); } } //For loop int pow(int base, int pwr){ int i; int result = 1; //The for loop initialises i to the value of pwr, then //runs the loop, subtracting 1 from i each time until //i fails the test (i > 0) at which point the loop finishes for(i = pwr; i > 0; i--){ result *= base } return result; } //While loop int pow(int base, int pwr){ int result = 1; while(pwr > 0){ result *= base; pwr--; } return result; }


Why you need a for loop when you have already while loop or do while loop?

We need a for loop because the while and do-while loops do not make use of a control variable. Although you can implement a counter inside a while or do-while loop, the use of a control variable is not as self-evident as it is in a for loop. Aside from the use of a control variable, a for loop is largely the same as a while loop. However, it is quite different to a do-while loop, which always executes at least one iteration of the loop before evaluating the conditional expression. In a for and while loop, the conditional expression is always evaluated before entering the loop, which may result in the loop not executing at all.


What is the different between loop and do while loop?

no difference in logic in both of them you put the key to enter :while( ....),for(;....;) but infor loop you have option to initialize value and make operation on it for(int i=0;...;i++){} same int i=0; while(..){ i++;}


What is do while loop in VB 6?

Structure: do (while(expression) or until(expression)) . . . loop (while(expression) or until(expression)) This is called a loop in VB and it is used to do something more than one times. It may be used without any of the parameters "while" or "until" but in such case you have to make your code exit of the loop or most likely your program is going to stop responding. The while parameter is used when we want the code in the loop to be executed WHILE the expression is True. Example: variable = variable + 1 The until parameter is used when we want the code in the loop to be executed until the expression gets True. Example: variable = variable + 1


How does loop work?

In programming, a loop works by conditionally jumping to the start of the loop and repeating the instructions. If the condition evaluates false, execution continues to the next instruction, thus breaking out of the loop. We can also break out of a loop from within the body of the loop itself using another conditional jump which jumps out of the loop. If we jump backwards out of a loop we effectively create an intertwined loop, known as spaghetti code which is difficult to read and maintain. Structured loops help make it easier to digest the logic. In C, a jump is achieved using a goto and a label. However, structured loops using for, while and do-while statements make loops much easier to read and maintain.

Related questions

What three parts that make up Earth's mantle?

The three parts that make up the Earths mantle are the crust, core, and mantle.


Which class of British warship is noticeably split into three different 'blocks' of super-structure?

This would be the Type 23 warship. The three sections make it easy to seal off parts of the ship if there is a fire or flooding.


What is the definition of close the loop in recycling?

The term "close the loop" is a three part process: 1) recycle our waste, 2) make something new out of it, 3) buy recycled.


What are the sides that make up the DNA?

There is the D side, which stands for Dexterity, the N side, representing Neurose, and the A side, representing Ambien. These three 'sides' or strands form a triangle structure that loop into the distinct circle pattern that most people are familiar with.


What are three things titanium is used to make?

Aicraft parts, Engine parts,Weapon parts


What are three parts that make up earths mantle?

The three parts that make up the Earths mantle are the crust, core, and mantle.


How do you make a trapezoid into 3 equal parts?

Make it into three triangles.


What three parts make up the upper extremities?

trunk, arms, headHand, forearm, and upper arm.The arm, the forearm, and the hand are the three parts that make up the upper extremeties.the arm headwhat three parts make up the upper extremintiesfingers, nose and ears.


What are the parts that make up the mantle?

The three parts that make up the Earths mantle are the crust, core, and mantle.


What three parts make?

The three parts that make up nucleotides are a phosphate molecule, a 5-carbon ribose sugar and a nitrogenous base. DNA and RNA make up nucleotide chains.


What is the frame of the bicycle?

Well, basically you need something to hold the parts together to make it into a working structure as opposed to a pile of parts.


What three parts make up the upper extreites?

uh8h9i