This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathslash.lcdoc
More file actions
79 lines (57 loc) · 2.18 KB
/
slash.lcdoc
File metadata and controls
79 lines (57 loc) · 2.18 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Name: /
Type: operator
Syntax: <dividend> / <divisor>
Summary:
Divides one number by another number or one array by another array.
Introduced: 1.0
OS: mac, windows, linux, ios, android, html5
Platforms: desktop, server, mobile
Example:
# Dividing a literal number by another
local approxPi
put 22/7 into approxPi -- approximates pi
Example:
# Dividing two variables
local thisVariable
get thisVariable/(thisVariable + 1)
Example:
# Dividing an array by another
local tNumberArray, tDivisorArray, tDividedArray
put 10 into tNumberArray[1]
put 20 into tNumberArray[2]
put 10 into tDivisorArray[1]
put 5 into tDivisorArray[2]
put tNumberArray / tDivisorArray into tDividedArray
put tDividedArray[1] & comma & tDividedArray[2]
# Yields 1,4
Parameters:
dividend:
A number or an expression that
evaluates to a number, or an array containing numbers.
divisor:
A number or an expression that
evaluates to a number, or an array containing numbers.
Description:
Use the </> (divide) <operator> to divide one number by another.
> *Note:* When used in complex arithmetic statements,
<operator|operators> like </> follows standard rules of <precedence>.
To divide the contents of a container by a number, use the <divide>
<command> instead.
If <dividend> or <divisor> is an <array>, each of the <array>
<element(glossary)|elements> must be a number. If an <array> is divided
by a number, each <element(keyword)> is divided by the number. If an
<array> is divided by an <array>, both <array|arrays> must have the same
number of <element(glossary)|elements> and the same dimension, and each
<element(keyword)> in one <array> is divided by the corresponding
<element(keyword)> of the other <array>.
If an element of an array is empty, the </> <operator> treats its
contents as zero.
> *Important:* Attempting to divide by zero causes an execution error.
Changes:
The option to divide arrays was introduced in version 1.1. In previous
versions, only single numbers could be used with the / operator.
References: divide (command), operator (glossary), array (glossary),
command (glossary), element (glossary), element (keyword),
div (operator), precedence (glossary),
mod (operator), * (operator), wrap (operator)
Tags: math