From: Rick DeNatale Date: 2007-12-22T00:59:59+09:00 Subject: Re: Problem with case statements On Dec 21, 2007 9:01 AM, murphy wrote: > >>>> 57: case args.first > >>>> 58: when :first: find_first(options) > >>>> 59: when :all: find_all(options) > >>>> 60: else raise "Invalid find" > >>>> 61: end > >>>> `require': /home/hemant/push_server/lib/db_connection.rb:58: syntax > >>>> error, unexpected ':', expecting keyword_then or ',' or ';' or > >>>> '\n' (SyntaxError) > >>>> when :first: find_first(options) > >>>> ^ > >> Looks like they deprecated ":" in case statements. > you can replace them with ";" or "then" to be Ruby 1.8 and 1.9 > compatible. but it's ugly. I prefer the colon variant. > > can we have the colon back, matz? at least for "case". > [murphy] I suspect that it's gone because of a conflict with the new keyword style hash literal syntax in 1.9. On the other hand changing the colon to a semi-colon will work. when :first; find_first(options) -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/