GM: while
From GMpedia.org Wiki
|
while (expression) | |
| Type: | statement |
| Limitations: | none |
- The correct title of this article is while (expression). It appears incorrectly here because of technical restrictions.
The Game Maker while is a type of different loops in Game Maker. Its syntax is as follows:
while (<expression>)
{
<statement>
}
The do-until loop repeats the <statement> as long as the <expression> is true. Each times it performs the <statement>, it then evaluates the <expression>, 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 a wrong <expression> will result in an infinity-loop, which will result in crashing the game.
[edit] Example
while (timer > 0)
{
timer -= 1
// coding goes here that will repeat until time = 0;
}
[edit] See Also
Content from Game Maker Knowledge Base, was used to expand this article. The content was contributed by Abyssal_Nuclei.

