Error codes

E0281: zero-padding format on a non-number

In a terminal: auk explain E0281 prints this page.

On this page

In "{n:05}", the leading 0 pads a number with zeros. Zero-padding text isn't meaningful, so it's rejected for non-numbers; pad with spaces instead.

Wrong#

auk
fn code(s: str): str = "{s:05}"

Fixed#

auk
fn code(s: str): str = "{s:>5}"

Common causes#

  • Formatting a number that's stored in a str: parse it first, or pad with spaces.
  • {x:05} on a value that only looks numeric.

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