Skip to content

Commit 5e9d6a4

Browse files
authored
[[ Documentation ]] Changes to and.lcdoc
- Reverted earlier syntax change so that syntax only shows two operands. - Renamed params to leftValue and rightValue throughout. - Adjusted Description to accommodate reverted syntax, while describing what happens in expressions with > 2 operands.
1 parent c6785b3 commit 5e9d6a4

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

docs/dictionary/operator/and.lcdoc

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ Name: and
22

33
Type: operator
44

5-
Syntax: <value1> and <value2> [and <value3> ...]
5+
Syntax: <leftValue> and <rightValue>
66

77
Summary:
8-
Allows the creation of compound <boolean> expressions, which <evaluate> to true
9-
if all <operand|operands> are true, false otherwise.
8+
Allows the construction of compound <boolean> expressions, which <evaluate> to true
9+
if both <operand|operands> are true, false otherwise.
1010

1111
Introduced: 1.0
1212

@@ -27,40 +27,38 @@ local myCount
2727
if the shiftKey is down and myCount > 1 then exit mouseUp
2828

2929
Parameters:
30-
value1 (bool):
31-
Value1 is true or false, or an expression that evaluates to
30+
leftValue: (bool):
31+
leftValue is true or false, or an expression that evaluates to
3232
true or false.
3333

34-
value2: (bool):
35-
Value2 is true or false, or an expression that evaluates to
36-
true or false.
37-
38-
value3: (bool):
39-
Value3 is true or false, or an expression that evaluates to
34+
rightValue (bool):
35+
rightValue is true or false, or an expression that evaluates to
4036
true or false.
4137

4238

4339
Description:
4440
Use the <and> <operator> to combine two or more <logical>
4541
<value(glossary)|values> into a compound <boolean> <expression>.
4642

47-
If <value1> is false or <value2> is false, or if both <value1> and
48-
<value2> are false, then the <and> <operation> <evaluate|Evaluates> to
49-
false. If <value1> and <value2> are both true, the <expression> <value1>
50-
and <value2> <evaluate|Evaluates> to true. In an <expression> with more
51-
than two operands, if any of the operands <evaluate|evaluates> to false,
43+
If <leftValue> is false or <rightValue> is false, or if both <leftValue> and
44+
<rightValue> are false, then the <and> <operation> <evaluate|evaluates> to
45+
false. If <leftValue> and <rightValue> are both true, the <expression> `leftValue
46+
and rightValue` <evaluate|evaluates> to true. In an <expression> with more
47+
than two <operand|operands>, there is an implicit grouping of the first pair,
48+
so that the first pair is <evaluate|evaluated> first, then subsequent values
49+
are <evaluate|evaluated>. If any of the operands <evaluate|evaluates> to false,
5250
the entire <expression> <evaluate|evaluates> to false. You can combine
5351
the <logical> <operator|operators> <and>, <or>, and <not>
5452
in an <expression>.
5553

5654
>*Note:* LiveCode uses what is known as "short-circuit evaluation" for
57-
> <logical> <operator(glossary)|operators>. This means that <value1> is
58-
> <evaluate|evaluated> first. If <value1> is false, the <expression>
59-
> value1 and value2 is false regardless of what <value2> is (because the
55+
> <logical> <operator(glossary)|operators>. This means that <leftValue> is
56+
> <evaluate|evaluated> first. If <leftValue> is false, the <expression>
57+
> `leftValue and rightValue` is false regardless of what <rightValue> is (because the
6058
> <expression> <evaluate|evaluates> to false unless both the values are
61-
> true). In this case, LiveCode does not <evaluate> <value2>, since
62-
> doing so is not necessary to determine the <value(function)> of <value1>
63-
> or <value2>. For example, evaluating the <expression> `asin(2)` normally
59+
> true). In this case, LiveCode does not <evaluate> <rightValue>, since
60+
> doing so is not necessary to determine the <value(function)> of <leftValue>
61+
> or <rightValue>. For example, evaluating the <expression> `asin(2)` normally
6462
> causes an <execution error> (because 2 is not a legal <argument> for the
6563
> arc sine function), but <evaluate|evaluating> the <expression>
6664
> `(1 = 0) and (asin(2) = 1)` does not cause an error: since `(1 = 0)` is

0 commit comments

Comments
 (0)