Docs menu

E101: A character literal must hold exactly one character

What compiler error E101 means, and how to fix it.

A char is a single character, written between single quotes: 'a'. Turf found something between the quotes that isn’t exactly one character – either nothing at all, or more than one.

Example
mut empty: char = '';       // nothing between the quotesmut two: char = 'ab';       // two characters

A character literal holds exactly one:

Example
mut letter: char = 'a';

If you wanted several characters, you want a string, which uses double quotes:

Example
mut word: string = "ab";

An escape sequence like '\n' is still one character (a new line), so that is fine. And if you meant a single quote itself, write '\''.

Run turf --explain E101 in a terminal to read this again.

Last updated: Oct 15, 2026Edit this page on GitHub

Esc

Type to search.