answersLogoWhite

0


Best Answer

No. If the loop condition is not satisfied then the loop would not be executed even once.

while(condition)

{

.....

/statements

.....

}

here,when the condition is true then the statements will be executed. Otherwise they would be skipped without being executed.

Only for do.. while loops this execution at least once holds good.

User Avatar

Wiki User

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

Wiki User

8y ago

The do loop, also known as the do-while loop, always executes its loop body at least once. The conditional expression that controls the loop is evaluated at the end of each iteration rather than at the beginning of each iteration as per a while or for loop.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

The do-while loop.

// This will always print out once, even though the loop condition will always fail.

do {

System.out.println("In the loop!");

} while(false);

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

The do ... while loop executes atleast once as it is an exit control loop.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

At least once.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Does The statements within a while loop execute at least once?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is main different between do while and while?

If you want to execute a statement which is in while loop at least one time you can use do- while loop. this is why because initially first statements will be executed then condition will be checked. but in case of while first condition will be check then statements will be executed


What is the minimum number of times a do- while loop is executed?

A do while loop is executed at least one time.


What is the difference between do while and while loop in java?

A do-while loop guarantees the body of the loop will execute at least once. A while loop might not execute at all. // this code will execute, even though the condition test will always evaluate to false do { // stuff }while(false); // this code will never execute because the condition test will always evaluate to false while(false) { // stuff }


What is difference between for loop and do-while loop?

The do loop is similar to the forloop, except that the expression is not evaluated until after the do loop's code is executed. Therefore the code in a do loop is guaranteed to execute at least once. The following shows a do loop in action: do { System.out.println("Inside do while loop"); } while(false); The System.out.println() statement will print once, even though the expression evaluates to false. Remember, the do loop will always run the code in the loop body at least once. Be sure to note the use of the semicolon at the end of the while expression.


What type of loop always execute at least once?

A do-while loop always executes at least once, and works like this: do { //code, such as incrementing a value, printing text, etc. } while (expressionToEvaluate); a perfect example of this would be something like: <code> int i = 10; int counter = 0; do { counter+=i; i--; } while (i > 0); </code>

Related questions

What is the difference between do while and while?

In while, from the very first term, every time, the related conditions in while will be checked and then the statements will execute. But, in do-while, all the statements under do will execute once and then compiler will check the while condition. Therefore, only first time only statements will execute without checking the conditions in while, but not from the second term repetition. written by DILSHAN MADUSANKA dilshanmadusanka@yahoo.com


What is main different between do while and while?

If you want to execute a statement which is in while loop at least one time you can use do- while loop. this is why because initially first statements will be executed then condition will be checked. but in case of while first condition will be check then statements will be executed


What is the Difference between while and do while?

Both are programming commands. A do/while loop will execute at least once. A while loop may not execute at all.


What is the minimum number of times a do- while loop is executed?

A do while loop is executed at least one time.


What is the difference between do while and while in C language?

WhileDo-While1. In this statement, the Boolean expression is checked before executing the loop body.1. In this statement, the Boolean expression is checked after executing the loop body for the first time.2. It doesn't execute its statement if the condition fails.2. It will execute its statements at least once even if the condition fails. After that if the condition founds false the execution stops.It is mainly used in menu like programs where all the available choices are printed at least once.3. General loop form iswhile (condition){statements}3. General loop form isdo{statements} while (condition)4. Executing a code at least once tend to be relatively rare, thus the simple while is more commonly used4. This used for a block of code that must be executed at least once5. While loop is entry control loop5. Do while is exit control loop


How to create the do-while statement in programming in c?

A do-while statement in a c programing can be create as per the following syntax-do{.................................;.................................; SETS OF THE EXECUTABLE STATEMENTS..................................;} while(condition);as per the above mentioned syntax it will work.it means that 1st the set of executable statements will execute atleast once before checking for the condition and then it will go to check for the condition mentioned within the while.it means suppose if the condition given inside the while is incorrect then also the executable part will execute atleast once and after executing that it will go to while and will check for the conditon.If the condition will be true then it will execute till the condition exists otherwise will come out of the loop only.HERE CARE SHOULD BE TAKEN THAT AFTER THE WHILE WE SHOULD PUT SEMICOLON.BUT IN ONLY WHILE LOOP WE DONT USE THAT.


What is the difference between do while and while loop in java?

A do-while loop guarantees the body of the loop will execute at least once. A while loop might not execute at all. // this code will execute, even though the condition test will always evaluate to false do { // stuff }while(false); // this code will never execute because the condition test will always evaluate to false while(false) { // stuff }


What is difference between for loop and do-while loop?

The do loop is similar to the forloop, except that the expression is not evaluated until after the do loop's code is executed. Therefore the code in a do loop is guaranteed to execute at least once. The following shows a do loop in action: do { System.out.println("Inside do while loop"); } while(false); The System.out.println() statement will print once, even though the expression evaluates to false. Remember, the do loop will always run the code in the loop body at least once. Be sure to note the use of the semicolon at the end of the while expression.


Looping statement in c plus plus?

There are several 'looping' statements in C++. They are:while () { }do { } while () ;for (index-start, index-end; index increment/decrement) { }They are used to repetitively execute statements as long as the statement(s) controlling the loop are true.


What function does the ORA 06550 do?

ORA 06550 is an error code that can be encountered while executing PL/SQL statements in Oracle database. It is reported if the parameters used to execute a stored procedure are incorrectly named.


Difference between for and while statements in java?

Both for and while belongs to repetitive controls structure. for is used when a user does not know how manytimes the looping needs to be executed i.e. infinite in some cases.Also in case of for initialization,condition and step decrement/ increment can take place in a single loop. In viceversa case while is used. In case of while we first check the condition if it is satisfied , only then execute the statements present below the loop. Both for and while belongs to repetitive controls structure. for is used when a user does not know how manytimes the looping needs to be executed i.e. infinite in some cases.Also in case of for initialization,condition and step decrement/ increment can take place in a single loop. In viceversa case while is used. In case of while we first check the condition if it is satisfied , only then execute the statements present below the loop.


Within which taxonomic group do members show at least varition and withim which group do they show the most?

Members within a species show the least variation, while members within a kingdom show the most variation.