3 ms·
Also, unlike the for loop alternative, it clearly expresses the intent. "I am filtering this array, using this condition". The functional programming style real
by mvindahl 9y ago
Also, unlike the for loop alternative, it clearly expresses the intent. "I am filtering this array, using this condition". The functional programming style really shines here, and it shines even more whan you start chaining the operations.
I guess the rule of thumb is to write code to most clearly express the intent of it. Often harder said than done but a good goal to strive for.
- collyw 9y agoTo be fair the new arrow operator syntax is a bit cryptic. I am sure Ruby offers plenty of things like that, because when I look at Ruby codebases I often don't understand what they intend to achieve.