Skip to content

Comment on Java is becoming the new Cobolparent

Comments

I don't think that Ruby code will do what the original poster at the language shootout thought it would, as it's not equivalent to the Java code above it. If it were correct though, you could improve it by being more Ruby-like and doing it like this:

puts STDIN.inject {|sum, next_number| sum.to_i + next_number.to_i}

. . . or something.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.