DIFFERENCES BETWEEN WHILE AND
DO-WHILE LOOP:
1. In
While loop the condition is
tested first and then the statements are executed if the condition turns out to
be true.
In do while the statements are executed for the first time and then the conditions
are tested, if the condition turns out to be true then the statements are
executed again.
2. A do while is used for a block
of code that must be executed at least once.
These situations tend to be relatively rare, thus the simple while is more commonly
used.
3. A do while loop runs at least once
even though the the condition given is false
while loop do not run in case the condition given is false
4. In a while loop the condition is
first tested and if it returns true then it goes in the loop
In a do-while loop the condition is
tested at the last.
5. While loop is entry control loop
where as do while is exit control loop.
6. Syntax:
while loop :
while (condition)
{
Statements;
}
do while loop :
Do
{
Statements;
}while(condition)
tested first and then the statements are executed if the condition turns out to
be true.
In do while the statements are executed for the first time and then the conditions
are tested, if the condition turns out to be true then the statements are
executed again.
2. A do while is used for a block
of code that must be executed at least once.
These situations tend to be relatively rare, thus the simple while is more commonly
used.
3. A do while loop runs at least once
even though the the condition given is false
while loop do not run in case the condition given is false
4. In a while loop the condition is
first tested and if it returns true then it goes in the loop
In a do-while loop the condition is
tested at the last.
5. While loop is entry control loop
where as do while is exit control loop.
6. Syntax:
while loop :
while (condition)
{
Statements;
}
do while loop :
Do
{
Statements;
}while(condition)
The while loop checks
whether the test expression is true or not. If it is true, code/s inside
the body of while loop is executed,that is, code/s inside the braces { } are
executed. Then again the test expression is checked whether test expression is
true or not. This process continues until the test expression becomes false.
Iron Ring for Men - Titanium Lines
ReplyDeleteIron Ring for Men 2020 edge titanium for Iron Rings. titanium septum jewelry Iron Ring for Men - Titanium Lines. Iron Ring for Men - Titanium Lines. Iron Ring for Men titanium damascus - Titanium Lines. Iron t fal titanium pan Ring snow peak titanium for Men -