<doc>
  <legacy_id>1161</legacy_id>
  <name>and</name>
  <type>operator</type>
  <syntax>
    <example><i>value1</i> and <i>value2</i></example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Math, Logic, &amp; Dates</category>
  </classification>
  <references>
    <constant tag="false">false Constant</constant>
    <operator tag="or">or Operator</operator>
    <operator tag="bitAnd">bitAnd Operator</operator>
  </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><glossary tag="evaluate">Evaluates</glossary> to true if both <glossary tag="operand">operands</glossary> are true, false otherwise.</summary>
  <examples>
    <example>(1 &gt; 0) and (1 = 0)</example>
    <example>(1 &gt; 0) and (1 = 1) and (0 = 0)</example>
    <example>if the shiftKey is down and myCount &gt; 1 then exit mouseUp</example>
  </examples>
  <description>
    <p>Use the <b>and</b> <glossary tag="operator">operator</glossary> to combine two or more <glossary tag="logical">logical</glossary> <glossary tag="value">values</glossary>.</p><p/><p><b>Parameters:</b></p><p>The <i>value1</i> and <i>value2</i> are true or false, or <glossary tag="expression">expressions</glossary> that <glossary tag="evaluate">evaluate</glossary> to true or false.</p><p/><p><b>Comments:</b></p><p>If <i>value1</i> is false or <i>value2</i> is false, or if both <i>value1</i> and <i>value2</i> are false, then the <b>and</b> <glossary tag="operation">operation</glossary> <glossary tag="evaluate">Evaluates</glossary> to false. If <i>value1</i> and <i>value2</i> are both true, the <glossary tag="expression">expression</glossary> <i>value1</i> and <i>value2</i> <glossary tag="evaluate">Evaluates</glossary> to true.</p><p>You can combine the logical operators <b>and</b>, <operator tag="or">or</operator>, and <operator tag="not">not</operator> in an <glossary tag="expression">expression</glossary>.</p><p/><p><b>Note:</b> <glossary tag="LiveCode">LiveCode</glossary> uses what is known as "short-circuit evaluation" for <glossary tag="logical">logical operators</glossary>. This means that <i>value1</i> is <glossary tag="evaluate">evaluated</glossary> first. If <i>value1</i> is false, the <glossary tag="expression">expression</glossary> value1 and value2 is false regardless of what <i>value2</i> is (because the <glossary tag="expression">expression evaluates</glossary> to false unless both the values are true). In this case, LiveCode does not <glossary tag="evaluate">evaluate</glossary> <i>value2</i>, since doing so is not necessary to determine the <function tag="value">value</function> of value1 or value2. For example, evaluating the <glossary tag="expression">expression</glossary> asin(2) normally causes an execution error (because 2 is not a legal <glossary tag="argument">argument</glossary> for the arc sine function), but <glossary tag="evaluate">evaluating</glossary> the <glossary tag="expression">expression</glossary> (1 = 0) and (asin(2) = 1) does not cause an error:  since (1 = 0) is always false, the whole statement is always false and LiveCode never tries to <glossary tag="evaluate">evaluate</glossary> the <function tag="asin">asin function</function>.</p>
  </description>
</doc>