diff --git a/docs/language_concepts/data_types/03_strings.md b/docs/language_concepts/data_types/03_strings.md index ee69853..6cc731f 100644 --- a/docs/language_concepts/data_types/03_strings.md +++ b/docs/language_concepts/data_types/03_strings.md @@ -41,3 +41,23 @@ fn main() { assert(message_bytes[0] == message_vec.get(0)); } ``` + +## Escape characters + +You can use escape characters for your strings, as much as escape sequences: + +| Escape Sequence | Description | +|-----------------|-----------------| +| `\r` | Carriage Return | +| `\n` | Newline | +| `\t` | Tab | +| `\0` | Null Character | +| `\"` | Double Quote | +| `\\` | Backslash | + +Example: + +```rust +let s = "Hello \"world" // prints "Hello "world" +let s = "hey \tyou"; // prints "Hello world" +```