From: dblack@... Date: 2007-07-27T08:38:04+09:00 Subject: Re: n00b if condition quest Hi -- On Fri, 27 Jul 2007, Phrogz wrote: > On Jul 26, 4:22 pm, Brett Boge wrote: >> I'm sure theres a way, so how does one do: >> >> if (a = b or a = c or a = d or a = f) >> >> in a shorter, easier to view >> >> if (a = (b c d or f)) kind of way? > > case n > when 1,2,3: puts '1-3' > when 4..6: puts '4-6' > else puts 'other' > end > > You can, of course, use variables instead of literals, ala > > case a > when b, c, d, f > ... > end That doesn't test for equality, though. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)