Hacker News new | past | comments | ask | show | jobs | submit login

I believe that Ruby also has that & shortcut (or similar) but it's totally unreadable. I never used it and I don't even want to check the exact syntax. Is it the only way it works in Crystal?



It being readable is a matter of getting used to it. I find it more readable than the block version as there is less syntactic boilerplate. YMMV.

Ruby has a similar version using colon instead of dot but that version isn't chainable and doesn't take arguments so it can't do the *2.

And no, you can write out the full block just as you did in the Ruby version.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: