Ruby 1.9: What to Expect

OSCON 2008

Colon no longer valid in when statements


ruby 1.9

irb(main):001:0> case ‘a’; when /\w/: puts ‘word’; end
SyntaxError: (irb):1: syntax error, unexpected ’:’,
expecting keyword_then or ’,’ or ’;’ or ’\n’

ruby 1.8.6

irb(main):001:0> case ‘a’; when /\w/: puts ‘word’; end
word

Action: use semicolon, then, or newline