Xo is experimental. The source code is not public yet; it will be soon. Read the release notes
Menu · XO0502

Docs

XO0502: assignment to an immutable binding or to a captured variable

error · reported by the checker

Only var bindings, var parameters, var receivers, and their fields and elements can be assigned or passed to a var parameter. let, constants, pattern bindings, and for bindings are immutable. Closures capture by value, so mutating a captured var inside a closure is also an error; share state through a Mutex or Atomic instead. See core 3.3 and 5.2.

Example

fn f() -> Int {
  let x = 1
  x = 2
  x
}

Fix

fn f() -> Int {
  var x = 1
  x = 2
  x
}

Run xo explain XO0502 for this text in a terminal, or see section 10.6 of the specification.