Game Guides > Game FAQ >  

How is a while loop different from a do until loop in gml

How is a while loop different from a do until loop in gml
In any programming language, a "while" loop and a "do until" loop are the same except for 1 difference.

In order to enter a while loop, the condition must always be true.
But in a do until loop, if the condition was false, the block of code inside the loop will always be ran at least once.

Example:
while (false)
{
// code here
}
in this example, the code inside the while loop will never run,

but in the following example:
do
{
//code here
}
until(false)
although the condition is false, the code will be run 1 single time and the exists the loop.