<doc>
  <legacy_id>1639</legacy_id>
  <name>case</name>
  <type>keyword</type>
  <syntax>
    <example>case <i>value</i></example>
    <example>case <i>condition</i></example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Writing LiveCode</category>
  </classification>
  <references>
    <control_st tag="switch">switch Control Structure</control_st>
    <control_st tag="break">break Control Structure</control_st>
  </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 within a <control_st tag="switch">switch</control_st> <glossary tag="control structure">control structure</glossary> to designate one of the possibilities to be handled.</summary>
  <examples>
    <example>case "A"</example>
    <example>case myChar = "A"</example>
  </examples>
  <description>
    <p>Use the <b>case</b> <glossary tag="keyword">keyword</glossary> to indicate the condition for which a set of <glossary tag="statement">statements</glossary> should be <glossary tag="execute">executed</glossary>.</p><p/><p><b>Comments:</b></p><p>The <b>case</b> <glossary tag="keyword">keyword</glossary> can be used in two forms. The first form is used when the <control_st tag="switch">switch</control_st> <glossary tag="statement">statement</glossary> includes an <glossary tag="expression">expression</glossary>: the case is <glossary tag="execute">executed</glossary> if the <i>value</i> after the <keyword tag="word">word</keyword> case is equal to the expression in the <control_st tag="switch">switch</control_st> <glossary tag="control structure">control structure</glossary>. For example, if the <control_st tag="switch">switch</control_st> <glossary tag="control structure">structure</glossary> starts with this <glossary tag="statement">statement</glossary>:</p><p/><p>  switch thisVariable</p><p/><p>then a <b>case</b> <glossary tag="statement">statement</glossary> inside the <control_st tag="switch">switch</control_st> <glossary tag="control structure">structure</glossary> might look like this:</p><p/><p>  case 3</p><p/><p>and the lines following the <b>case</b> <glossary tag="keyword">keyword</glossary> are executed if thisVariable = 3. Use this form if you want to test a single value, and do different things depending on what that <function tag="value">value</function> is equal to.</p><p/><p>The second form is used when the <b>switch</b> <glossary tag="statement">statement</glossary> does not include an <glossary tag="expression">expression</glossary>: the case is <glossary tag="execute">executed</glossary> if the <i>condition</i> after the word case is true. For example, if the <b>switch</b> <glossary tag="control structure">structure</glossary> starts with this <glossary tag="statement">statement</glossary>:</p><p/><p>  switch</p><p/><p>then a <b>case</b> <glossary tag="statement">statement</glossary> inside the <control_st tag="switch">switch</control_st> <glossary tag="control structure">structure</glossary> might look like this:</p><p/><p>  case the short name of this card contains "a"</p><p/><p>and the statements following the <b>case</b> <glossary tag="keyword">keyword</glossary> are <glossary tag="execute">executed</glossary> if the <keyword tag="character">character</keyword> "a" appears in the <glossary tag="current card">current card's</glossary> name.</p>
  </description>
</doc>