Sisu
E0060

print or eprint of an array

Error

Built from the repository at commit a8614dc.

print and eprint write one i64, u8, f64, bool, char or string. An array, or an optional array, is many values.

Why

There is no one way to print an array: on one line or many, with or without separators. A loop prints each element the way the program needs.

Broken

fn main() {
    let xs = [1, 2, 3]
    print(xs)
}

What sisu says

error[E0060]: cannot print `[i64]`
 --> E0060.sisu:3:11
  |
3 |     print(xs)
  |           ^^
  |
  = help: print each element in a `for` loop

sisu: 1 error
sisu: for more on a code, run `sisu explain <code>`: E0060

Fixed

fn main() {
    let xs = [1, 2, 3]
    for x in xs {
        print(x)
    }
}

Related

  • E0059: print or eprint of something else it cannot print.