News for hackers. Stuff that matters.
Re:I don't like Python. Does that make me a bad person? by carbon8 on Saturday June 26, 2010 @12:41PM (#1463889)
The ruby examples don't behave the same as the python version since they use ARGF in place of stdin. They are also non-idiomatic. Here is a correct, idiomatic Ruby version:

    $stdin.read.split.each do |w|
      puts w if w.match(/ing$/)
    end
or as a single 57 column line:

    $stdin.read.split.each { |w| puts w if w.match(/ing$/) }
we can also use the match operator:

    $stdin.read.split.each { |w| puts w if w =~ /ing$/ }
I'm inclined to assume that the other language examples are also suspect.

There are no comments on this comment yet.