From: Sam Roberts Date: 2004-02-04T22:38:33+09:00 Subject: Re: RCR draft for enhanced "case..when..else..end" syntax Quoteing bob.news@gmx.net, on Wed, Feb 04, 2004 at 05:35:03PM +0900: > > >>Do you know about this syntax currently available? > > >> > > >>a = "aaa" > > >>b = "bbb" > > >>case > > >> when a == "aaa", b == "bbb" > > >> puts "Lowercase detected" > > >> when a == "AAA", b == "BBB" > > >> puts "Uppercase detected" > > >> else > > >> puts "Detection failed" > > >>end > > I couldn't find it in the Pickaxe - I'll file it under "Hidden Treasures > of Ruby"... :-) There's a lot of info jammed into the corners of the pickaxe book! For this syntax, there's an example in the section "Case Expressions", p84, and then in chapter 18 it shows the syntax: case target when comparison [, comparison]]... [then] body when comparison [, comparison]]... [then] body ... [ else body ] end Cheers, Sam