...

/

The Relation to String Slices

The Relation to String Slices

We'll cover the following...

This next bit isn’t strictly necessary to understand most programming in Rust, but I think it’s helpful.

There’s a data type we haven’t directly talked about yet, called a char. It represents a single character. This could be the letter A, or the @ sign, or the Hebrew letter Alef (א), or many other things. We’ll get back to that part. In Rust (and many other languages), a character literal is a character surrounded by single quotes, e.g., 'A'.

A string, logically, is a sequence of characters. You can think of "Hello" as ['H', 'e', 'l', 'l', 'o']. However, that’s not the way Rust actually represents a string. Instead, it does something totally ...