Error codes

E0207: not iterable

In a terminal: auk explain E0207 prints this page.

On this page

for loops over a list, a map, a range (0..n) or a Set. This value is none of those. A str isn't iterated directly: say whether you want its chars(), bytes() or lines().

Wrong#

auk
fn main() {
  for c in "abc" { print(c) }
}

Fixed#

auk
fn main() {
  for c in "abc".chars() { print(c) }
}

Common causes#

  • Looping over a string: use .chars(), .lines() or .split(...).
  • Looping over a number: write for i in 0..n.
  • Looping over a T? or T!: unwrap it first with ? or else.

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