answersLogoWhite

0


Best Answer

While--wend statement is used to execute a loop until a given condition is true.if the condition is false the loop ends and the program continous to the line following eend.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the purpose of wend statement in while loop in gw-basic?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Basic Math

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


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


What are the purpose of test condition in a loop statement in qbasic?

The purpose of using a 'test condition' inside of a loop statement/which is also called a 'conditional loop'; is to make the loop STOP counting. Otherwise, you would have gone and created what is known as being called an 'endless loop'; which just keeps on running really quite endlessly, forevermore...! To give a quick example, let's compare... CONDITIONAL LOOP EXAMPLE num% = 0 DO num% = num% + 1 PRINT num%; LOOP UNTIL num% = 3 END Output... 1 2 3 Press any key to continue... Here, when the LOOP's test condition is met: (num%=3); then, the loop stops counting up any further; the DO/LOOP block structure is broken out of; and, the final END statement will get executed. UNCONDITIONAL LOOP EXAMPLE Next, let's try re-writing the same above program; by removing the conditional statement part of the LOOP which says: (UNTIL num%=3)... num% = 0 DO num% = num% + 1 PRINT num% LOOP END Output... 1 2 3 4 5 6 7 8 9 10 11 12 .... ...because there is no conditional test statement to make the loop stop repeating itself; therefore, it just keeps on endlessly counting upwards, instead; the program never breaks out of the DO/LOOP block; and, therefore never gets to reach the final END statement. To make an 'unconditional loop' stop repeating itself inside of QBASIC IDE/Integrated Development Environment; then, use combination key press: [CTRL] + [BREAK]; and, this should make an 'endless loop' stop repeating itself any further; and, return you straight back to the Editor Screen where you can futher change/edit your code.


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.)


Which loop is used in php?

while, do...while, for, foreach are used

Related questions

What is the purpose of break statement in c?

The break statement exits control of the innermost for, while or do-while loop, or switch statement.


What is purpose of break statement?

to terminate a loop.


What are control structures used in javascript?

The control structures used in java script are if-statement, for-loop, for-in loop, while loop,do-while loop, switch-statement, with-statement. try-catch-finally statements.


Can you write switch statement with in while loop?

Yes. The same goes for for-loop and do-while-loop.


Difference between for and while loop not in syntactically?

Well 'while' goes like this: while (condition) statement 'for': for (initialize; condition; after-each-loop) statement


What is the definition of 'nested' in C programming?

In C a structure within a structure is called nested. For example, you can embed a while loop in another while loop or for loop in a for loop or an if statement in another if statement.


How do you convert a while loop to do-while loop?

A for loop is classified as an iteration statement. A simple example might be... For x = 1 To 10 'loop body Next x The same loop expressed as a while loop (classified as a control flow statement) could be... x = 0 Do While x &lt; 11 'loop body x = x + 1 Loop .


How can you define null statement in loop in C programming?

If you are using for loop for(;;); or you can also define condition and iterations but the loop has to close there itself without any statement inside it. In the similar way you can define while and do while loop without any statement.


Why you use while function in c?

It is a statement; you can create a loop with it: while (&lt;condition&gt;) &lt;statement&gt;


What is used to end a do loop?

A while statement.


What is while statement and how is it used?

You use a while statement to introduce a conditional loop. Unlike a for loop which is typically used for counted loops, a while loop is used whenever a statement must iterate while an expression evaluates true. The expression is evaluated at the start of each iteration.


Do while loop flowchart?

do &lt;statement&gt; { while (Boolean expression); }