docs

You are reading the docs for v0.1.0. Nabi 0.1.0 is no longer supported. Latest release: v0.1.3 →

#E0056: invalid indexing

The value cannot be indexed, or the index is not an integer. Index arrays, lists and slices with integers, and types that implement Index with their key.

nabi
let total = 120;
println(f"{total[0]}");
error[E0056]: cannot index into a value of type `i64`
  --> main.nabi:2:12
   |
 2 | println(f"{total[0]}");
   |            ^^^^^^^^

Index a collection:

nabi
let totals = [120, 80];
println(f"{totals[0]}");
120

Related: E0040 mismatched types

Found a mistake? Edit this page on GitHub. Last updated