1 |
|
2 |
|
3 | # Function and
|
4 |
|
5 | Logical `and`. Test whether two values are both defined with a nonzero/nonempty value.
|
6 | For matrices, the function is evaluated element wise.
|
7 |
|
8 |
|
9 | ## Syntax
|
10 |
|
11 | ```js
|
12 | math.and(x, y)
|
13 | ```
|
14 |
|
15 | ### Parameters
|
16 |
|
17 | Parameter | Type | Description
|
18 | --------- | ---- | -----------
|
19 | `x` | number | BigNumber | Complex | Unit | Array | Matrix | First value to check
|
20 | `y` | number | BigNumber | Complex | Unit | Array | Matrix | Second value to check
|
21 |
|
22 | ### Returns
|
23 |
|
24 | Type | Description
|
25 | ---- | -----------
|
26 | boolean | Array | Matrix | Returns true when both inputs are defined with a nonzero/nonempty value.
|
27 |
|
28 |
|
29 | ## Examples
|
30 |
|
31 | ```js
|
32 | math.and(2, 4) // returns true
|
33 |
|
34 | a = [2, 0, 0]
|
35 | b = [3, 7, 0]
|
36 | c = 0
|
37 |
|
38 | math.and(a, b) // returns [true, false, false]
|
39 | math.and(a, c) // returns [false, false, false]
|
40 | ```
|
41 |
|
42 |
|
43 | ## See also
|
44 |
|
45 | [not](not.md),
|
46 | [or](or.md),
|
47 | [xor](xor.md)
|