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

Docs

XO0166: `while cond` used as an expression; only `while { }` is one

error · reported by the parser

A while loop with a condition may end without producing a value, so it is a statement. Only the infinite loop while { ... } is an expression, whose value comes from break. Move the loop into its own statement and compute the value separately. See core 3.5.

Example

fn f(a: Bool) {
  let x = while a { }
}

Fix

fn f(a: Bool) {
  while a { }
}

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