Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In Rust, omitting a semicolon has a special meaning, ie a return from an expression. So, you can't just ditch it.

I wouldn't mind Python's whitespace indents in Rust though!



> In Rust, omitting a semicolon has a special meaning, ie a return from an expression. So, you can't just ditch it.

Of course you could, because a semicolon-less return doesn't work in the middle of a statement.

You can't do

    bla;
    a
    bla bla;
    b
instead of

    bla;
    return a;
    bla bla;
    b
Yes, the code after the `return` isn't reachable and the Rust compiler doesn't like that ;)


But that would mean

  {123 456} + {789}
was 1245 instead of 124_245.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: