It starts with a boolean (true or false) expression. If the expression evaluates to true then the following statement or block of statements is run.
For example:
int num = 5;
while (num < 9) {
<code that does something goes here>
num++;
}
In this example the contents of the while loop will be executed 4 times
while (condition) {
//do something
}
For example:int i = 0;
while ( i < 3){
System.out.println("hello");
i++;
}
Will print "Hello" to the console 3 times
In case of while loop when condition is true then answer is displayed if condition is false then no output is produced
At least 0 times
0 if condn is false
1 or more till condn is true
A Loop.
A For loop requires 3 parameters:for( int i = 0; i < 10; ++i ){}So, the first parameter - int i = 0 - shows the integer that you will be using to cycle with. This variable sometimes corresponds with what you're cycling through, so if you're using an array, array notation dictates that you can access the array with integers.The second parameter - i < 10 - says that if the i variable is less than 10, do the for loop.The third parameter - ++i - shows by how many you want to increment or decrement the variable by. This means that the for loop I have provided will run 10 times. (Remember: if you start at 0 - which all arrays and vectors e.t.c will do - you need to start your For loop at 0)
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++;}
If one loop ends before the next begins then they are not nested at all -- they are completely independent. To be nested, one loop must contain the other loop in its entirety. That is, the inner, nested loop must start and end within the outer, containing loop. Nested loop example (in C++): for( int x = 0; x < 10; ++x ) // outer loop { for( int y = 0; y < 10; ++y ) // inner loop (nested loop) { printf( "%d x %d = %d\r\n", x, y, x*y ); } // end of inner loop } // end of outer loop
while loop and for loop are entry controlled loops as they check looping condition at the entry point. do while loop is exit controlled loop as it checks looping condition at exit point. shreeradha@yahoo.com
You wrap the wool twice around your finger, then put the back loop over, then loop one more, back loop over, and so on.
A Loop.
A while loop evaluates the conditional expression at the start of each iteration, whereas a do..while loop evaluates the conditional expression at the end of each iteration. Thus the do..while loop always executes at least one iteration.
Nowhere . . . it is a closed loop with no beginning and no end.
In drama, a loop dialogue is a conversation spoken by two people ( a dialogue), but is kept on being spoken from start to finish in a loop. Hence the name lopp dialogue
first to start off u might want to use 2 different colors!!!!!!!!!!!!!!!!!! step 2 u loop one color toward the right then loop the other color toward the left!!!!!!!!!!!!!!!!! then u loop the other side in and then loop the side put!!!!!!!!!!!!!!!!!! now u pull it tightly and start again!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HAVE FUN!!!!!!!!!!!!! LOL!!!!!!!!!! GNR!!!!!!!!!!!!!!!!!!!!!
A do-while loop is a statement or series of statements that are executed at least once. At the end of each iteration, a conditional expression enclosed in a while() statement is evaluated to determine if the loop should start a new iteration or not.
The 'break' command will stop a loop from going any further, where a 'continue' command will start the loop over at the top (or bottom) of the loop, bypassing other instructions that may be in the loop. The 'continue' command will not stop a loop, but a 'break ' command will.Note: these statements aren't commands or functions.
When a loop structure is preceded by an initial read the last statement in the loop is likely to be an 'if not end-of-file'. However, this construct would fail if there were no data in the file to start with, as the loop would be processed one time with no data. End-of-file should be checked at the top of the loop, and boundary conditions such as this one ought to be considered.
A For loop requires 3 parameters:for( int i = 0; i < 10; ++i ){}So, the first parameter - int i = 0 - shows the integer that you will be using to cycle with. This variable sometimes corresponds with what you're cycling through, so if you're using an array, array notation dictates that you can access the array with integers.The second parameter - i < 10 - says that if the i variable is less than 10, do the for loop.The third parameter - ++i - shows by how many you want to increment or decrement the variable by. This means that the for loop I have provided will run 10 times. (Remember: if you start at 0 - which all arrays and vectors e.t.c will do - you need to start your For loop at 0)
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++;}
Loop Loop Loop Loop - 2014 was released on: USA: 15 February 2014