Name: and

Type: operator

Syntax: <value1> and <value2> 

Summary: <evaluate|Evaluates> to true if both <operand|operands> are true, false otherwise.

Introduced: 1.0

OS: mac,windows,linux,ios,android

Platforms: desktop,server,web,mobile

Example:
(1 &gt; 0) and (1 = 0)

Example:
(1 &gt; 0) and (1 = 1) and (0 = 0)

Example:
if the shiftKey is down and myCount &gt; 1 then exit mouseUp

Parameters:
value1 (bool): The value1 and value2 are true or false, or expressions that evaluate to true or false.
value2: 

Description:
Use the <and> <operator> to combine two or more <logical> <value(glossary)|values>.

If <value1> is false or <value2> is false, or if both <value1> and <value2> are false, then the <and> <operation> <evaluate|Evaluates> to false. If <value1> and <value2> are both true, the <expression> <value1> and <value2> <evaluate|Evaluates> to true.
You can combine the logical operators <and>, <or>, and <not> in an <expression>.

>*Note:* <Revolution|LiveCode> uses what is known as "short-circuit evaluation" for <logical operators(glossary)>. This means that <value1> is <evaluate|evaluated> first. If <value1> is false, the <expression> value1 and value2 is false regardless of what <value2> is (because the <expression evaluates(glossary)> to false unless both the values are true). In this case, LiveCode does not <evaluate> <value2>, since doing so is not necessary to determine the <value(function)> of value1 or value2. For example, evaluating the <expression> asin(2) normally causes an execution error (because 2 is not a legal <argument> for the arc sine function), but <evaluate|evaluating> the <expression> (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 <evaluate> the <asin function>.

References: false (constant), bitAnd (operator), not (operator), or (operator), value (function), asin function (function), Revolution (glossary), operand (glossary), value (glossary), operation (glossary), operator (glossary), logical (glossary), expression (glossary), evaluate (glossary), argument (glossary)

Tags: math
