answersLogoWhite

0


Best Answer

The "body" of a loop is the code being executed on each iteration.

while(x < 10) {

// beginning of body
doStuff();
printStuff();
doOtherStuff();
++x;
// end of body
}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the body of a loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Compare Do-While with While Statements?

A Do-While loop looks like this: do { loop body } while (condition); and a While loop looks like this: while (condition) { loop body } The main difference is that the loop body is always run once in the Do-While loop, then the condition is checked to see if the loop should keep running. In a While loop, the condition is checked first, and it will not run the loop body at all if the condition is false.


What is difference between for loop statement and do while statement in c language?

The for loop has an initializer, an end condition, a loop expression, and a body. The initializer always runs. If the end condition is not satisified, the loop ends or never starts. The loop expression runs at the end of each iteration. Note that the body of a for loop can run no times. The do while statement has a body and an end condition. The body is executed, and then the end condition determines if the loop will iterate. Like the for loop, the loop expression runs at the end of each iteration. Note that the body of a do while loop will run at least one time.


What the difference between pretest loop and posttest loops?

The difference is that pre means before and post means after in Latin so it's tested before or after. :)


What are the statements executed within a loop collectively known as?

The body of the loop.


What is a nested loop in java?

A nested loop is a (inner) loop that appears in the loop body of another (outer) loop. The inner or outer loop can be any type: while, do while, or for. For example, the inner loop can be a while loop while an outer loop can be a for loop.


Is the for loop a pretest type of loop?

Pretest loops, such as for-loop, while-loop, execute/evaluate the condition statement first, if the condition is met, then the statements of the loop are executed. If you were referring to the body of the loop being carried out at least once, no, the body will not be touched if the condition fails (pre-test, test BEFORE the [next] execution of the body). But the condition of the loop must have been evaluated at least once.In contrast to the post-test loops, such as do-while, repeat-until, the condition is evaluated AFTER the [next] execution of the body. It is possible that the condition is never evaluate, and not the entire loop body being executed.


What is the pattern of blood flow through the 2 loops of the body?

the first loop is lungs to the heart. the second loop is body to the heart.


What is loop 1 in the circulartory?

The loop one is where the heart pumps out and goes through the body.


What is unique about a DOWHILE loop?

A DO-WHILE loop will always execute at least one iteration of the loop body. This is because the condition that controls the loop comes at the end of the loop, rather than at the beginning as per a WHILE or FOR loop.


What are the differences between while and do while?

while- It will wrok only if the condition is correct if not it wont excute the body of the loop do-while: In some cases we want that body of the loop and the condition may fails so the loop want to print so the do while loop first excute body of the loop and next it checks the condition it continues until the condition becomes false


Which command is used to skip the rest of a loop and carry on from the top of the loop again?

From inside any loop statement, the continue; statement will skip any remaining statements and re-evaluate the loop's conditional expression. If that expression remains true, a new iteration of the loop begins, otherwise control passes to the statement that follows the loop. Note that in a for or while loop, the conditional expression is defined before the loop body but in a do loop it is defined after the loop body.


Definition of loop and its types and programs in c plus plus?

Executing a segment of a program repeatedly by introducing a counter and later testing it using the if statement.A sequence of statements are executed until some conditions for termination of the loop are satisfied.A Program loop consists of two segments:1.Body of the loop2. Control StatementDepending on the position of the control statement in the loop, a control strcture may be classifies either as the 2:Entry Controlled LoopExit Controlled Loop1.Entry Control Loop-(Pre Test Loop)The control conditions are tested before the start of the loop execution.If the conditions are not satisfied , then the body of the loop will not be executed.]eg:While Loop2.Exit Control Loop-(Post Test loop)The Test is performed at the end of the body of the loop and there fore the body is executed unconditionally for the first time.eg:Do-Whilewhile loopfor loopdo-while loop