------art_136446_27250484.1183695271821
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I agree. --Not so sure a case statement makes sense here. Tell us what you
are trying to accomplish. Is it to get clarity on ruby's case statements? or
to really follow the logic you've detailed?

puts i if [1,3].include? i
puts "1 or 2" if [1,2].include? i


On 7/5/07, Nasir Khan <rubylearner / gmail.com> wrote:
>
>    when 1:   puts "1"
>   when 1,2: puts "1 or 2"
>
> Logically does'nt make much sense.
> Here "when 1" is redundant, your puts "1 or 2" will never be printed even
> when value is either 1 or 2 as you want.
>
> The question is  - What are you actually trying to do?
>
> On 7/4/07, tobyclemson / gmail.com <tobyclemson / gmail.com> wrote:
> >
> > Sorry type was misleading - the variable could be anything, I'm not
> > doing anything to do with the class of an instance. I had tried it out
> > but I'm quite new to ruby so I doubted myself and thought I'd ask
> > those in the know!
> >
> > On Jul 4, 11:32 am, "Robert Klemme" <shortcut... / googlemail.com>
> > wrote:
> > > 2007/7/4, tobyclem... / gmail.com <tobyclem... / gmail.com>:
> > >
> > >
> > >
> > > > Hi,
> > >
> > > > I've read through some of the other case statement posts but can't
> > > > find any that answer me this question.
> > >
> > > > I know that the case doesn't allow the follow through aspect of case
> > > > statements from other languages but is the following valid:
> > >
> > > > case type
> > > >   when 1
> > > >     # do stuff for type 1
> > > >   when 1,2
> > > >     # do stuff for both type 1 and 2
> > > > end
> > >
> > > > If it isn't valid, what is the easiest way to obtain this
> > > > functionality
> > >
> > > Why don't you just try it out?
> > >
> > > Btw, what is the "type" that you are checking?  I ask because if you
> > > want to do something based on the class of an instance there are
> > > different means.
> > >
> > > Kind regards
> > >
> > > robert
> > >
> > > --
> > > Have a look:http://www.flickr.com/photos/fussel-foto/
> >
> >
> >
>

------art_136446_27250484.1183695271821--