From: "Iñaki Baz Castillo" Date: 2009-07-22T06:19:40+09:00 Subject: Re: Simple problem with Regular Expression El Martes, 21 de Julio de 2009, Max Norman escribió: > > fruit = gets.chomp.downcase > > > > case fruit > > when "orange" > > color = "orange" > > when "apple" > > color = "green" > > when "banana" > > color = "yellow" > > else > > color = "unknown" > > end > > > > if %w{a e i o u}.include?(fruit[0]) > > puts "An #{fruit} is #{color}." > > else > > puts "A #{fruit} is #{color}." > > end > > Thanks for this. I've just come across a few of these concepts, like > literal arrays, denoted by %w{}. Could you explain your usage of the > literal array? Easy: irb> my_array = %w{a e i o u} ["a", "e", "i", "o", "u"] irb> my_array ["a", "e", "i", "o", "u"] -- Iñaki Baz Castillo