DEV Community

Discussion on: Challenge - Print Spiral

Collapse
 
yondrin profile image
Alex Doroshenko

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 };

Thread Thread
 
heikodudzus profile image
Heiko Dudzus

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.