# Testing if a variable is in an expression: has

### 5.59.5 Testing if a variable is in an expression: has

The has command determines whether or not an expression contains a variable.

- has takes two arguments:
  - expr, an expression.
  - x, the name of a variable.
- has(expr,x) returns 0 if expr doesn’t contain x, otherwise it returns an integer giving the position of x on lname(expr) (where the position starts at 1).

#### Examples.

- Input:
  has(x*y*sin(x),y)
  Output:

  2

- Input:
  has(x*y*sin(x),z)
  Output:

  0