Error codes

E0026: comparison operators cannot be chained

In a terminal: auk explain E0026 prints this page.

On this page

a < b < c would compare a bool with c in most languages, and mean a range test in others. Auk rejects it rather than pick one reading; spell out what you mean.

Wrong#

auk
fn between(a: int, b: int, c: int): bool = a < b < c

Fixed#

auk
fn between(a: int, b: int, c: int): bool = a < b && b < c

Common causes#

  • A math-style range check: write lo <= x && x < hi.
  • Comparing three values for equality: a == b && b == c.

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