From: 12 34 Date: 2007-06-21T09:17:24+09:00 Subject: Re: if == any item in an array Tim Pease wrote: > PhotoEndings = %w(JPG MRW JPE) > MovieEndings = %w(AVI) > > case ext.upcase > when *PhotoEndings > puts "I'm a photo!" > when *MovieEndings > puts "I'm a movie!" > else > puts "I'm unknown '#{ext}'" > end > > > When you were declaring your endings with the %w notation, you had put > commas between the file extensions. Therefore, your arrays only > contained one element. > > Give this code a shot. You almost had it -- the syntax you were > looking for was the leading splat "*" in front of the PhotoEndings and > MovieEndings in the branches of the case statement. > > Blessings, > TwP Thank you and all the others that answered. The array.include was what I was thinking too. But removing a couple of commas and adding a couple of astericks (splats) is nice. Ruby is great. I don't understand the meaning of the *. I imagine it comes from the wildcard usage. What do I look up in my books to understand this. Again thanks to the great community. All the answers help me learn. -- Posted via http://www.ruby-forum.com/.