4 ms·
Looks more like Ruby than Python, why the comparison to Python?
by pekk 13y ago
Looks more like Ruby than Python, why the comparison to Python?
- L8D 13y agoWhere 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
- skrishnamurthi 13y agoOkay, there's a Ruby example on the home page now, and probably one more on the way.
- skrishnamurthi 13y agoSecond Ruby example is in place now.