hello,

how do i prevent someone to enter duplicate word

for example,



eat = ""
data = []

print "what did you eat for dinner?: "
eat = gets.chomp

data << eat

so let say if they enter a food twice, it would print something like

" #{eat} you already entered that"

i was told to use Array#index, but i have no idea how to use it

thank you
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to