# `except`

_Exclude items from a list_
```syntax
x except y    except[x;y]
```

Where

- `x` is a list
- `y` is a list or atom

returns all items of `x` that are not in `y` (or not equal to `y`, if `y` is an atom).
```q
q)1 2 3 except 2
1 3
q)1 2 3 4 1 3 except 2 3
1 4 1
q)"hello" except "l"
"heo"
```

`except` uses [`in`](in.md) to identify items of `x` in `y`, which in turn uses [Find](find.md).
It is equivalent to `{x where not x in y}`.

Where `x` is a table, the result contains the rows of `x` that are not in table `y`.
```q
q)([]a:1 2 3) except ([]a:enlist 2)
a
-
1
3
```

`x` must be a list: an atom signals a `type` error.
```q
q)1 except 2
'type
  [0]  1 except 2
         ^
```

----

[Find](find.md),
[`in`](in.md),
[`within`](within.md)


[Selection](by-topic.md#selection)
