Puzzle 20Hello, Bonjour
 fn​ ​main​() {
 let​ hello = || println!(​"Hello World"​);
 let​ hello = || println!(​"Bonjour le monde"​);
 hello​();
 }

Guess the Output

images/aside-icons/important.png

Try to guess what the output is before moving to the next page.

images/hline.png

The program will display the following output:

 Bonjour le monde
images/hline.png

Discussion

In Puzzle 16, Double or Nothing, you saw that you cannot shadow functions with identical names—even if the parameter ...

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.