From: "Jesús Gabriel y Galán" Date: 2007-12-21T20:55:16+09:00 Subject: Re: Problem with case statements On Dec 21, 2007 12:48 PM, Lee Jarvis wrote: > Jesús Gabriel y Galán wrote: > > if you want to put the body of the when in the same line you need a > > then keyword: > > 1.8.6 works with a keyword or a colon, I think this is what Hemant > means.. 1.9 obviously doesn't support using them (I can't test it right > now) > > >> def find(*args) > >> case args.first > >> when :first: puts "first" > >> when :all: puts "all" > >> else raise "invalid" > >> end > >> end > => nil > >> find :first, 1, 2, 3, 4 > first > > > As you can see, Hemants example works fine with colons in 1.8.6, perhaps > not in 1.9, though... > I normally use 'then' in either case.. Oh, you are right, I missed the colon after the symbol. :-( Sorry for the noise. Jesus.