While

The Game Maker while is a type of different loops in Game Maker. It's syntax is as follows: while ( ) {      }

The while loop repeats the   as long as the   is true. Each time it performs the  , it then evaluates the  , if it is false, it stops and moves to the next action, if it is true, the loop is repeated, then the statement is re-evaluated, and so on.

One of the major troubles with the while loop is that writing an   that checks a variable, and within the   you do not change that variables value so that at some point the   is false then this will result in an infinity-loop, which will result in the game freezing or locking up.

Example
while (timer > 0) { timer -= 1 //this is an example of making sure at some point the   will equal false //other statements go here that will repeat until time <= 0 }

Infinity-Loop Technique
while and while (1) are examples of infinity-loops. However, sometimes it is useful to use this kind of loop when there is no single statement to determine whether or not to end the loop, and you must use more advanced programming techniques in conjunction with the break statement in order to exit the loop properly. This technique is used often to ask a user to input information until it is in the correct format. It is important to note, however, that this is only one technique, and there are many ways to do just about everything.

Infinity-loop Example
while (true) { input = ("Enter a string:",""); if ((input) != 0) {break;} }