From: Gennady Date: 2004-02-05T00:52:25+09:00 Subject: Re: RCR draft for enhanced "case..when..else..end" syntax Sam Roberts wrote: > 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 > > We are not talking about general "case" syntax, most of folks here are well aware of it (thanks for refreshing it anyway ;-)). It is rather about a special case when is not specified in "case" clause. It looks like it defaults to "true" so that may contain logical operators like "a == ". And I could not find it mentioned in the Pickaxe either. Gennady.