forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathor.lcdoc
More file actions
39 lines (23 loc) · 2.12 KB
/
Copy pathor.lcdoc
File metadata and controls
39 lines (23 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Name: or
Type: operator
Syntax: <value1> or <value2>
Summary: Evaluates to true if either <operand> is true, false if both <operand|operands> are false.
Introduced: 1.0
OS: mac,windows,linux,ios,android
Platforms: desktop,server,web,mobile
Example:
("a" > "b") or ("b" > "a") -- evaluates to true
Example:
(1 < 0) or (1 = 0) -- evaluates to false
Example:
wait until the controlKey is up or the commandKey is up
Parameters:
value1 (bool): The value1 and value2 are true or false, or expressions that evaluate to true or false.
value2:
Description:
Use the <or> <operator> to combine two or more <logical> (true or false) <value|values>.
If <value1> is true or <value2> is true, or if both <value1> and <value2> are true, then the <or> <operation> <evaluate|evaluates> to true. Only if both <value1> and <value2> are false does the <expression> value1 or value2 <evaluate> 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> <operator|operators>. This means that <value1> is <evaluate|evaluated> first. If <value1> is true, the <expression> value1 or value2 is true regardless of what <value2> is (because the <expression> <evaluate|evaluates> to true as long as at least one of the <value|values> is true). In this case, LiveCode does not <evaluate> <value2>, since doing so is not necessary to determine the value 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 = 1) or (asin(2) = 1) does not cause an error: since (1 = 1) is always true, the whole statement is always true and LiveCode never tries to <evaluate> the <asin> <function>.
References: not (operator), and (operator), bitOr (operator), bitXor (operator), asin (function), LiveCode (glossary), operand (glossary), value (glossary), operation (glossary), operator (glossary), logical (glossary), expression (glossary), evaluate (glossary), argument (glossary), function (control_st)
Tags: math