Monday, April 22, 2013

Correction to Example in Ruby Programming Language


In Ruby 2.0, I had to make changes to the given code in the book:

birthyear = 1975

generation = case birthyear
    when 1946..1963 then "Baby Boomer"
    when 1964..1976
      "Generation X"
    when 1978..2000
      "Generation Y"
    else nil
    end

p generation