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

Looks more like Ruby than Python, why the comparison to Python?


Where Ruby usually denotes code blocks with a `do` and an `end`, Python denotes code blocks with a `:` and an outdent. But also, Ruby has a lot more implicit syntax and uses methods as operators(`1 + 1 == 1.+(1)`). There are a few more things that wouldn’t be obvious, like how it is still indentation sensitive yet you still need to use an `end`. Also, you can avoid the `end` keyword is you include it on the same line, like so:

    fun square(n): n * n


Okay, there's a Ruby example on the home page now, and probably one more on the way.


Second Ruby example is in place now.




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

Search: