Puzzle 5 | How Long Is a String? |
| const HELLO_WORLD : &'static str = "Halló heimur"; |
| |
| fn main() { |
| println!("{} is {} characters long.", |
| HELLO_WORLD, |
| HELLO_WORLD.len() |
| ); |
| } |
Guess the Output | |
---|---|
Try to guess what the output is before moving to the next page. |
The program will display the following output:
| Halló heimur is 13 characters long. |
Discussion
Your eyes aren’t deceiving you—“Halló heimur”, contains ...
Get Rust Brain Teasers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.