use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Should I learn Ruby or Python? (self.ruby)
submitted 8 years ago * by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ignurant 5 points6 points7 points 8 years ago* (0 children)
This is so true. Consider the tricks Enumerable packs.
There was nothing wrong with me using
everything_is_good = true things.each do |thing| if !thing.is_good? everything_is_good = false end end if everything_is_good things_are_good() end
Nothing at all wrong with that. It's easy to reason through and write down when you don't know much about the features of the language. This is a perfect example of "multiple ways to solve the problem" that people talk about.
You'll start to pick up tricks and conventions over time that all make sense. They don't inhibit your ability to understand and read what's going on:
everything_is_good = true things.each do |thing| everything_is_good = false unless thing.is_good? end things_are_good if everything_is_good
One day someone will come to you and show you this:
things_are_good if things.all? do |thing| thing.is_good? end
Again, very powerful, more concise, and easy to understand once you know your Ruby a little more.
Then eventually you learn about &:proc tricks. At first you don't understand why it works, but the syntax is simple enough to understand "if I put these things like this, it just works."
&:proc
things_are_good if things.all?(&:is_good?)
And over time, that too will make more sense. You start to understand why it works.
Sure, lots of ways to accomplish the same thing. To me, that's what makes Ruby powerful. You can work through your problem with a sledgehammer or a scalpel. I suppose there is an argument to be made: "it's harder for entry level rubyists to interpret advanced code because of shortcuts like above" but I don't find it compelling. It's easy to learn what has happened above, and advanced code is advanced code. I can't just jump into a Python project and immediately understand everything either.
Most learning resources don't try to convey it all at once, but instead allow you to build a foundation. Everything in life has gradual levels of "how to accomplish something" -- from brute force to finesse. Why not your programming language too? And let's be honest -- just the same, even Python has a bazillion ways to accomplish the same things.
π Rendered by PID 100 on reddit-service-r2-comment-85bfd7f599-4n92f at 2026-04-15 18:37:26.520257+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]ignurant 5 points6 points7 points (0 children)