From: "W. Kent Starr" Date: 2001-04-26T00:34:57+09:00 Subject: [ruby-talk:14232] Re: An or in an if. On Wednesday 25 April 2001 10:33, Tim Pettman wrote: > Hi there, > > This is probably really simple, but how do I use an or on the right hand > side of an if? > > What I would like to do is this: > > if n == 3 or 5 > puts "true" > else > puts "false" > end > > > I could slpit this up to be: > > if n == 3 > puts "true" > elsif n == 5 > puts "true" > else > puts "false" > end > > but the first way seems easier. The case I am having to use this on is > quite a bit more compicated. > > Thanks in advance for your help. n == 3 or n == 5 ? true : false is one way :-) Regards, Kent Starr elderbun@mindspring.com