<doc>
  <legacy_id>1530</legacy_id>
  <name>break</name>
  <type>control structure</type>
  <syntax>
    <example>break</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
    <synonym>exit switch</synonym>
  </synonyms>
  <classification>
    <category>Writing LiveCode</category>
  </classification>
  <references>
    <control_st tag="exit">exit Control Structure</control_st>
    <control_st tag="switch">switch Control Structure</control_st>
    <keyword tag="case">case Keyword</keyword>
    <keyword tag="end if">end if 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>Skips the rest of the current <control_st tag="switch">switch</control_st> <glossary tag="control structure">structure</glossary> and goes to the <glossary tag="statement">statement</glossary> following the <keyword tag="end switch">end switch</keyword>.</summary>
  <examples>
    <example>switch thisVariable</p><p>case true</p><p>  doSomething</p><p>  break</p><p>case false</p><p>  doSomethingElse</p><p>  break</p><p>end switch</example>
  </examples>
  <description>
    <p>Use the <b>break</b> <glossary tag="control structure">control structure</glossary> to end each case section in a <control_st tag="switch">switch</control_st> <glossary tag="control structure">structure</glossary>.</p><p/><p><b>Form:</b></p><p>The word<code> break </code>appears on a line by itself, within a <b>case</b> section of a <control_st tag="switch">switch</control_st> <glossary tag="control structure">control structure</glossary>.</p><p/><p><b>Comments:</b></p><p>A <b>switch</b> <glossary tag="control structure">control structure</glossary> consists of one or more conditions. For each condition, a set of <glossary tag="statement">statements</glossary> is executed. The <b>break</b> <glossary tag="control structure">control structure</glossary> ends this set of <glossary tag="statement">statements</glossary> and breaks out of the <control_st tag="switch">switch</control_st> <glossary tag="control structure">structure</glossary>.</p><p/><p>If no <b>break</b> appears, LiveCode <glossary tag="execute">executes</glossary> each set of <glossary tag="statement">statements</glossary> in the following case sections, whether or not the condition in the case is true. This means that if you leave out the <b>break</b> <glossary tag="control structure">control structure</glossary>, more than one case in the <control_st tag="switch">switch</control_st> <glossary tag="statement">statement</glossary> may be executed. Occasionally, this is desirable, but usually you should include the <b>break</b> <glossary tag="control structure">control structure</glossary> at the end of each case, to ensure that only one set of <glossary tag="statement">statements</glossary> is executed.</p><p/><p><code/><b>Note:</b><code/> The <b>break</b> <glossary tag="control structure">control structure</glossary> is implemented internally as a <glossary tag="command">command</glossary> and appears in the <function tag="commandNames">commandNames</function>.</p><p/><p>The <b>break</b> <glossary tag="command">command</glossary> should not be used outside a <control_st tag="switch">switch</control_st> structure: such use is nonstandard, so it may not be apparent to whoever reads the code that the use is intentional. If it appears outside a <control_st tag="switch">switch</control_st> <glossary tag="control structure">structure</glossary>, it has the same effect as the <control_st tag="exit">exit</control_st> <glossary tag="control structure">control structure</glossary>.</p>
  </description>
</doc>