3 ms·
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 "eleme
by Aardappel 8y 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.
- yxhuvud 8y agoNo-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.