<doc>
	<legacy_id>2043</legacy_id>
	<name>wait</name>
	<type>command</type>

	<syntax>
		<example>wait {until | while} <i>condition</i> [with messages]</example>
		<example>wait [for] <i>number</i> [seconds | ticks | milliseconds] [with messages]</example>
		<example>wait for messages</example>
	</syntax>

	<synonyms>
	</synonyms>

	<summary>Pauses a <glossary tag="handler">handler</glossary> before <glossary tag="execute">executing</glossary> the rest of its <glossary tag="statement">statements</glossary>.</summary>

	<examples>
<example>wait for 2 seconds -- Waits for 2 seconds and blocks</example>
<example>wait until the mouse is up</example>
<example><p>wait while the seconds &lt; alarmTime</p></example>
<example>wait 10 milliseconds with messages -- Waits 10 milliseconds and DOES NOT block</example>
	</examples>

	<history>
		<introduced version="1.0">Added.</introduced>
		<deprecated version=""></deprecated>
		<removed version=""></removed>
		
		<experimental version=""></experimental>
		<nonexperimental version=""></nonexperimental>
	</history>

	<objects>
	</objects>

	<platforms>
		<mac/>
		<windows/>
		<linux/>
		<ios/>
		<android/>
	</platforms>

	<classes>
		<desktop/>
		<server/>
		<web/>
		<mobile/>
	</classes>

	<security>
	</security>


	<classification>
		<category>Writing LiveCode</category>
	</classification>

	<references>
		<function tag="seconds">seconds Function</function>
		<function tag="ticks">ticks Function</function>
		<function tag="waitDepth">waitDepth Function</function>
		<command tag="open socket">open socket Command</command>
		<property tag="lowResolutionTimers">lowResolutionTimers Property</property>
		<message tag="idle">idle Message</message>
		<control_st tag="repeat">repeat Control Structure</control_st>
	</references>

	<description>Use the <b>wait</b> <glossary tag="command">command</glossary> to delay a certain amount of time, or until something happens, before continuing a <glossary tag="handler">handler</glossary>.<p></p><p><b>Parameters:</b></p><p>The <i>condition</i> is an <glossary tag="expression">expression</glossary> that <glossary tag="evaluate">evaluates</glossary> to true or false. The <b>wait</b> <glossary tag="command">command</glossary> continuously evaluates this <glossary tag="expression">expression</glossary> while waiting.</p><p></p><p>The <i>number</i> is an integer. If you don't specify a unit of time, the <b>wait</b> <glossary tag="command">command</glossary> waits for <i>number</i> <function tag="ticks">ticks</function>.</p><p></p><p><b>Comments:</b></p><p>The <b>wait</b> <glossary tag="command">command</glossary> freezes <glossary tag="execute">execution</glossary> for the specified amount of time, or until the specified condition has been met, or until a <keyword tag="message box">message</keyword> has been sent.</p><p></p><p>The wait for time form waits for the specified time period. (The time elapsed during a <b>wait</b> <glossary tag="command">command</glossary> may be a few <function tag="milliseconds">milliseconds</function> more than the specified time, depending on the speed of the system and on the system's minimum time slice.)</p><p></p><p>If the wait..with messages form is used, LiveCode continues normal processing during the wait. The current handler is frozen, but the user can start other handlers and perform other actions such as switching cards.</p><p></p><p></p><tip>To complete a process after a pause while allowing LiveCode to run normally until that time, you can use the send in time form of the <command tag="send">send command</command> instead of using the wait...with messages form of the <b>wait</b> command.</tip><p></p><p>The wait for messages form waits until any message has been sent and the message has been handled. After any message handler runs, the handler containing the wait for messages statement resumes executing. Wait for messages handles at least one message but can handle more.</p></description>
</doc>