# or

Logical OR for symbolic expressions

## Syntax

``A | B``
``or(A,B)``

## Description

example

````A | B` represents the logical OR. `A | B` is true when either `A` is true or when `B` or both are true.```
````or(A,B)` is equivalent to `A | B`.```

## Examples

collapse all

Combine these symbolic inequalities into a logical condition by using `|`.

```syms x y xy = x>=0 | y>=0;```

Set the assumption represented by the condition using `assume`.

`assume(xy)`

Verify that the assumptions are set.

`assumptions`
```ans = 0 <= x | 0 <= y```

Combine two symbolic inequalities into a logical expression by using `|`.

`range = x < -1 | x > 1;`

Substitute `x` with `0` and `10`. Although the inequalities have values, `subs` does not evaluate them to logical `1` or `0`.

```x1 = subs(range, x, 10) x2 = subs(range, x, 0)```
```x1 = 1 < 10 | 10 < -1 x2 = 0 < -1 | 1 < 0```

Evaluate the inequalities by using `isAlways`.

`isAlways(x1)`
```ans = logical 1 ```
`isAlways(x2)`
```ans = logical 0```

Combine multiple conditions by applying `or` to the conditions using the `fold` function.

Set the condition that `x` equals an integer between `1` and `10`.

```syms x cond = fold(@or, x == 1:10); assume(cond) assumptions```
```ans = x == 1 | x == 2 | x == 3 | x == 4 | x == 5 |... x == 6 | x == 7 | x == 8 | x == 9 | x == 10```

## Input Arguments

collapse all

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

## Tips

• If you call `simplify` for a logical expression containing symbolic subexpressions, you can get the symbolic values `TRUE` and `FALSE`. These values are not the same as logical `1` (`true`) and logical `0` (`false`). To convert symbolic `TRUE` and `FALSE` to logical values, use `isAlways`.