# XO0501: var method called on a non var binding

A method with a `var` receiver (including mutating collection methods such as `push` and `put`) changes the caller's binding in place. It can be called only on a `var` binding, a `var` parameter, or a field of one. A `Mutex.with` closure parameter declared without `var` is a read only view. Declare the binding with `var` (the diagnostic offers that fix). See core 3.4 and 5.2.

## Example

```xo
fn f() -> List[Int] {
  let xs = [1]
  xs.push(2)
  xs
}
```

## Fix

```xo
fn f() -> List[Int] {
  var xs = [1]
  xs.push(2)
  xs
}
```

Run `xo explain XO0501` for this text in a terminal, or see
[section 10.6 of the specification](../../spec/core/#106-diagnostic-codes).

