docs

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

#E0007: a character literal holds one character

A '..' literal holds exactly one Unicode code point, and a c'..' literal exactly one byte. For text of any length use a string, "ab"; for a non-ASCII byte write \xHH.

nabi
let c = 'ab';
error[E0007]: char literal must contain exactly one code point
  --> main.nabi:1:9
   |
 1 | let c = 'ab';
   |         ^^^^

For more than one character, use a string:

nabi
let s = "ab";
println(s);
ab

Related: E0006 invalid escape in a literal, E0008 malformed f-string

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