Skip to content

Instantly share code, notes, and snippets.

View hasezoey's full-sized avatar

hasezoey hasezoey

View GitHub Profile
@hzhou
hzhou / 170331_2.md
Created April 1, 2017 02:55
Rust's return

A comment for: http://stackoverflow.com/questions/27961879/why-is-using-return-as-the-last-statement-in-a-function-considered-bad-style/43146646?noredirect=1#comment73380218_43146646

"It just is." is not a good answer for adults.

Conventions and styles are in the eyes of the users. If the majority of users find using return intuitive, then it is a good style, regardless what the language designers' opinions. If the majority of users use the "return" style, then it will be the convention.

Rust is quite new, so at this point, there is not really much convention or "good/bad" styles, it is just recommendations and guidelines. You have the choice of following them (a particularly good choice when you don't have much of your own opinions) or ignore them as long as it is still correct (a not bad choice if you have sufficient self-confidence).