Files
QtGameMaker/help/files/401_11_do.html
T

53 lines
1.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Do statement</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body background="images/back.gif">
<!--START-->
<h3>Do statement</h3>
A do statement has the form
<p>
<blockquote>
<pre><b>do</b> &lt;statement&gt; <b>until</b>(&lt;expression&gt;)</pre>
</blockquote>
<p>
The statement (which can also be a block) is executed until the expression
is true. The statement is executed at least once. Be careful with your do
loops. You can easily make them loop forever, in which case your game will
hang and not react to any user input anymore.
<p>
<b>Example</b><br>
The following program tries to place the current object at a free position
(this is about the same as the action to move an object to a random
position).
<p>
<blockquote>
<pre>
{
<b>do</b>
{
x = random(room_width);
y = random(room_height);
}
<b>until</b> (place_free(x,y))
}
</pre>
</blockquote>
<!--END-->
</body>
</html>
<!-- KEYWORDS
do statement
until
-->