re: Challenge - Print Spiral VIEW POST

re: Got it to Level 2, without using arrays at all. On level 2 this becomes purely a math problem, so its solutions will be probably pretty similar in ...

Seems like Rust functions return the final statement (for each case) without a return keyword? Edit: Ah, I see, implicit returns.


Yes, final statement is returned. Actually, almost anything with a block in Rust yields a final block statement as a value, so it's possible, for example, write something like let x = if y < 0 { -y } else { y };

That's quite common in functional programming, btw. When I read about Rust in early 2016, the most impressive and likeable idea was borrowing. And, of course, pattern matching. I like to see some Rust here.

Code of Conduct Report abuse