From: "Darryl L. Pierce" Date: 2011-11-09T23:25:19+09:00 Subject: Re: Can't get "or" or "||" to work. On 11/09/2011 09:02 AM, james gallagher wrote: > Hi. I have a stupid question. > > I'm stuck on the bit of ruby that follows: > > name = gets.chop.downcase > if name != "bob" || "fred" > puts "That wasn\'t one of the choices." > else > code > > If I put "bob" in it says: > > That wasn't one of the choices. > > It does the same for anything I put in. Your logic is off. You're wanting to see if name is either "bob" or "fred", right? Then you have to do: if (name != "bob") && (name != "fred") or, better still: unless ["bob", "name"].include? name What you've written is trying to compare name to a boolean (specifically the value of true) since "bob" || "fred" will be evaluated to a boolean expression. HTH. -- Darryl L. Pierce http://mcpierce.multiply.com/ "What do you care what people think, Mr. Feynman?"