Hacker News new | ask | show | jobs
by Aardappel 2639 days ago
Your Lobster version has a stray comma, it is: map(my_array) element: element * 2

Note how if you write this example with multiple statements instead of "elements * 2", suddenly the Lobster syntax looks a lot more consistent, and the Ruby example doesn't look that great as it looks completely different from the built-in for loop.

1 comments

No-one uses the built-in for loop in Ruby though. Instead, everyone uses the each method which looks the same as map.

That said, the Ruby syntax can be a bit bulky. Your syntax feels pretty clean TBH.