and

Allows the construction of compound boolean expressions, which evaluate to true if both operands are true, false otherwise.

# Metadata

Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android, web Introduced: 1.0 Security:

# Syntax

leftValue and rightValue

# Params

- leftValue : leftValue is true or false, or an expression that evaluates to true or false. - rightValue : rightValue is true or false, or an expression that evaluates to true or false.

# Examples

put (1 > 0) and (1 = 0) -- evaluates to false

put (1 > 0) and (1 = 1) and (0 = 0) -- evaluates to true

local myCount if the shiftKey is down and myCount > 1 then exit mouseUp

# Description

Use the and operator to combine two or more logical values into a compound boolean expression.

If leftValue is false or rightValue is false, or if both leftValue and rightValue are false, then the and operation evaluates to false. If leftValue and rightValue are both true, the expression `leftValue and rightValue` evaluates to true. In an expression with more than two operands, there is an implicit grouping of the first pair, so that the first pair is evaluate first, then subsequent values are evaluate. If any of the operands evaluates to false, the entire expression evaluates to false. You can combine the logical operators and, or, and not in an expression.

>*Note:* LiveCode uses what is known as "short-circuit evaluation" for > logical operators. This means that leftValue is > evaluate first. If leftValue is false, the expression > `leftValue and rightValue` is false regardless of what rightValue is (because the > expression evaluates to false unless both the values are > true). In this case, LiveCode does not evaluate rightValue, since > doing so is not necessary to determine the value of leftValue > or rightValue. 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 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.

# Tags

# See

- **operator:** bitAnd, not, or - **constant:** false, true - **function:** asin, value - **glossary:** argument, boolean, evaluate, execution error, expression, function, logical, operand, operation, operator, value