Error codes

E0260: operator not applicable to these types

In a terminal: auk explain E0260 prints this page.

On this page

The operator isn't defined for this combination of types. Auk has no implicit numeric conversions, so float * int is an error: convert one side with float(n) or int(x).

Wrong#

auk
fn scale(x: float, n: int): float = x * n

Fixed#

auk
fn scale(x: float, n: int): float = x * float(n)

Common causes#

  • Mixing int and float, including literals: write 2.0, not 2, with floats.
  • + between a str and a number: interpolate instead, "n = {n}".
  • < on a type that isn't Ord.

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