DEV Community

Discussion on: Narcissistic number

Collapse
 
jay profile image
Jay

The inclusive range (..=) that I've used is available from Rust 1.24. It will work with previous versions. But you can change it from (0..=1_000_000) to (0..1_000_001) and it should work in any previous version.

repl.it uses Rust 1.9, the for_each method for iterator is avalable from 1.21 onwards. You can save the filtered list and call for loop on elements.

Here's the repl.it link with formatted code, that will work over there. link

If you want to run the newer version, here's a link to rust playground with the code.

Have fun 😃