Error codes

E0255: else on a value that can't fail

In a terminal: auk explain E0255 prints this page.

On this page

else handles the bad case of a T!, a T?, or a pattern that might not match. This value is a plain type and the pattern always matches, so the else could never run.

Wrong#

auk
fn main() {
  let x = 1 else 2
  print(x)
}

Fixed#

auk
fn main() {
  let x = 1
  print(x)
}

Common causes#

  • A function that used to return T? or T! and now returns a plain value.
  • else used as a general "or" operator: use if/else for conditions.

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page