answersLogoWhite

0

How does a for loop start?

Updated: 8/10/2023
User Avatar

Wiki User

11y ago

Best Answer

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

User Avatar

Wiki User

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

Wiki User

12y ago

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

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

In case of while loop when condition is true then answer is displayed if condition is false then no output is produced

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

At least 0 times

0 if condn is false

1 or more till condn is true

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How does a for loop start?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What structure causes a statement or set of statements to execute repeatedly?

A Loop.


Which statements are nedded to control 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)


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++;}


When loops are nested does one loop have to end before the other begins?

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 &lt; 10; ++x ) // outer loop { for( int y = 0; y &lt; 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


What is the difference between entry and exit controlled loops - in Java?

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

Related questions

How do you start finger knitting?

You wrap the wool twice around your finger, then put the back loop over, then loop one more, back loop over, and so on.


What structure causes a statement or set of statements to execute repeatedly?

A Loop.


What is a do-while 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.


Where does your circulatory system start?

Nowhere . . . it is a closed loop with no beginning and no end.


What is the drama phrase loop dialog mean?

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


How do you make 4 way landyards?

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!!!!!!!!!!!!!!!!!!!!!


What is while loop?

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.


Difference between break function and continue function?

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 what is likely to be the last statement in the loop?

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.


Which statements are nedded to control 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)


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 are the release dates for Loop Loop Loop Loop - 2014?

Loop Loop Loop Loop - 2014 was released on: USA: 15 February 2014