# Testing if an object is in an interval: contains

### 5.38.7 Testing if an object is in an interval: contains

The contains command determines if an object is in an interval.

- contains takes two arguments:
  - I, an interval.
  - obj, an object.
- contains(I,obj) returns 1 if obj is in I; i.e., either obj is a number which is contained in I or obj is an interval which is a subset of I. It returns 0 otherwise.

#### Examples.

- Input:
  contains(i[0,2],1)
  Output:

  1

- Input:
  contains(i[0,2],3)
  Output:

  0

- Input:
  contains(i[0,2],i[1,2])
  Output:

  1