answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: What value of flag will cause this loop to terminate?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Basic Math

How does a FOR loop work in GML?

FOR loops work as follows:{for( [initialize a variable]; [expression]; [increment the variable] ) {//Do this code}}Here as an example of a FOR loop:{for(i = 1; i < 10; i += 1) {show_message(string(i));}}What this will do is show a message 10 times displaying the value of "i" so you would get a message that says "1," another one after that saying "2," etc... The way this works is that you have the variable "i" initialized in the FOR loop. The FOR loop will keep looping until i >= 10, because the middle statement dictates that i must be smaller than 10 for the FOR loop activate. The third statement in the for loop is the statement that you increment the i variable with. If you change i += 1 to i -= 1 then the FOR loop would go on forever, freezing the game. This is a critical mistake to make when constructing a FOR loop (as is with any loop.)


When a VBScript loop control variable is not altered during loop execution what kind of loop may result?

An infinite loop.


How to use while loop statement in php?

simple code example: &lt;? while ($a &lt; 10 ) { echo "$a, "; $a++; } echo "Finished"; ?&gt; Will output, 1, 2, 3, 4, 5, 6, 7, 8, 9, Finished this will run through the loop WHILE $a is less than 10, outputting the value of $a to the screen. once $a = 10 then the loop will end and continue on with the rest of the script


How does a WHILE loop work in GML?

The while loop works as follows:{while( [expression is true] ) {//Do this code}}The while loop re-runs until the expression contained within the parentheses is false. Take a look at this example:{while(!place_meeting(x,y,obj_ground)) {y += 1;}}This while loop tells the object to move down one pixel until it collides with obj_ground. Unfortunately, nothing guarantees that this loop will not run forever. Always make sure that when you construct a while loop that you make sure that it does not run forever. Take a look at this whileloop:{while(obj_ball.y < y) {draw_sprite(sprite_index,0,x,y);}} This while loop will run for ever. Why? It does not have any statements that insure that the while loop aborts. Again, Always make sure that when you construct a loop that you put statements in the loop that will eventually abort the loop. y -= 1; is the statement in this new while loop that eventually aborts the loop:{while(obj_ball.y < y) {draw_sprite(sprite_index,0,x,y); y -= 1;}}


What are the differences between a condition-controlled loop and a count-controlled loop?

A Condition-Controlled loop keeps going until a certain condition is met, like say the user clicks a button, or the world ends or something. A Counter controlled loop keeps going until it has run a certain number of times. For example if you create a variable x=0. And then every time your look runs you increase x by 1 (x=x+1), you can tell your loop to keep running until x=5. That way the loop would run 5 times until the *COUNTER* reaches 5. This would be a counter controlled loop

Related questions

How do you terminate in C language a loop?

The keyword "break" will immediately terminate the enclosing loop. Otherwise using conditions in the loop will terminate the loop once the condition becomes false. eg int i = 0; int b =0; for(i ; i &lt; 3; i ++){ b++; } Will increment i and b on each iteration. The loop will terminate when i &gt;= 3 (when the condition i &lt; 3 becomes false).


What is purpose of break statement?

to terminate a loop.


How do you fix an infinite loop?

It comes from its name: it doesn't terminate, the user have to interrupt the program-run (in the worst case: power off the computer).The infinite loop is also used to program loops with non-easily-deterministically end-of-loop conditions.You write an infinite loop, such as for (;;) {statements}, and break out of the loop with the break statement when ready to terminate.


What are break and continue statement in c language?

Break is used to exit the closest loop. Continue will cause the program to go to the beginning of the loop. for(int x=0;x&lt;10;x++) { //continue; for(int y=0;y&lt;10;y++) { break; } } The break statement causes the inner loop to stop at the first iteration. If the continue statement was uncommented, the inner loop would never be executed because the program would jump back to the beginning(until x = 10 of course).


What do you mean by loop check?

A loop check is a condition that is checked everytime a loop is executed. It is usually the condition that needs to match for the loop to terminate. Until this condition is matched the loop will continue to execute. Ex: for(int i=0; i&lt;10; i++) { &acirc;&euro;&brvbar; } In the above for loop "i&lt;10" is the loop check condition and this loop will execute until the value of i is less than 10. It starts at 0 and gets incremented by 1 everytime the loop completes an iteration of execution


What do you mean by check?

A loop check is a condition that is checked everytime a loop is executed. It is usually the condition that needs to match for the loop to terminate. Until this condition is matched the loop will continue to execute. Ex: for(int i=0; i&lt;10; i++) { &acirc;&euro;&brvbar; } In the above for loop "i&lt;10" is the loop check condition and this loop will execute until the value of i is less than 10. It starts at 0 and gets incremented by 1 everytime the loop completes an iteration of execution


In endless loop the value of i2 k10 and the loop will terminated when value of you is greater than k and the value of k is assign to 17 after the loop and it is said to endless loop why?

"In endless loop the value of i2 k10 and the loop will terminated when value of you is greater than k and the value of k is assign to 17 after the loop and it is said to endless loop why?"


C plus plus what do you do if im stuck in an infinite loop?

There are three ways out of a loop.1. Satisfy the loop ending condition2. Execute a break statement3. Terminate the programPerhaps you are not changing the value of the variable that is used in the loop ending condition. Perhaps you are using a variable, such as an unsigned int, decrementing it, and expecting it to go negative. Suggest you run the program in a debuger and step through the loop.


What type of loop is For k equals 7 to maxValue?

A very poorly defined loop. By default the looping index increases. The loop, as described in the question will not terminate if "maxValue" is less than 7.


What does a condition controlled loop mean?

A condition-controlled loop is one that has an indefinite number of iterations; its opposite is the count-controlled loop. Condition-controlled loops execute until some event occurs, which is usually user-initiated. For example, modern programs run an condition-controlled loop similar to the following: while(GetMessage(message,hwnd,0,0)) { ... } This loop continues to execute until there are no messages left (the WM_QUIT message is returned, which has a value of zero). It is impossible to identify before execution the number of times such a loop will run, except during controlled tests, although you can easily identify what conditions will cause it to terminate.


How do you terminate a thread which is continuously executing?

A thread that is continuously executing has an infinite loop. To terminate that thread you must break that loop by providing a suitable terminating condition. If the thread is a "worker" thread, the main thread should signal all worker threads to terminate when the main thread terminates. The main thread should remain active until all worker threads have successfully terminated.


What type of loop can either increment or decrement the loop control variables value?

Counting Loop