<doc>
  <legacy_id>1109</legacy_id>
  <name>for</name>
  <type>keyword</type>
  <syntax>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Writing LiveCode</category>
  </classification>
  <references>
    <keyword tag="while">while Keyword</keyword>
    <control_st tag="repeat">repeat Control Structure</control_st>
    <keyword tag="until">until Keyword</keyword>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary>Used in a <control_st tag="repeat">repeat</control_st> <glossary tag="control structure">control structure</glossary> to specify the number of times the <glossary tag="loop">loop</glossary> should repeat.</summary>
  <examples>
    <example>repeat for 10 times</example>
    <example>repeat for (the number of buttons)</example>
  </examples>
  <description>
    <p>Use the <b>for</b> <glossary tag="keyword">keyword</glossary> to specify a fixed number of <glossary tag="iteration">iterations</glossary> of a <glossary tag="loop">loop</glossary>.</p><p/><p><b>Comments:</b></p><p>The number may be a literal number, or an expression that evaluates to a number. (If the number is not an integer, it is rounded to the nearest integer.) Either way, the number is evaluated when the <b>repeat</b> <glossary tag="control structure">control structure</glossary> is entered, and is not re-<glossary tag="evaluate">evaluated</glossary> as a result of <glossary tag="statement">statements</glossary> in the <glossary tag="loop">loop</glossary>. For example, if the <control_st tag="repeat">repeat</control_st> <glossary tag="control structure">control structure</glossary> begins with the line</p><p/><p><code>  repeat for the number of cards</code></p><p/><p>then this number is evaluated as of the start of the loop, and the number does not change even if the statements in the loop create or delete cards. For this reason, use caution when using the <b>for</b> <glossary tag="keyword">keyword</glossary> with an <glossary tag="expression">expression</glossary>: do not assume the <glossary tag="expression">expression</glossary> will have its current <function tag="value">value</function> when the <glossary tag="statement">statements</glossary> inside the <glossary tag="loop">loop</glossary> are <glossary tag="execute">executing</glossary>.</p>
  </description>
</doc>