Currently doing exercise 35 on Learn Ruby the hard way.
http://ruby.learncodethehardway.org/book/ex35.html

Heres the piece of code that I'm playing with:


def gold_room()
  puts "This room is full of gold.  How much do you take?"

  prompt; next_move = gets.chomp

  if next_move.include? "0" or next_move.include? "1"
    how_much = next_move.to_i()
  else
    dead("Man, learn to type a number.")
  end


Currently if the user inputs "0 Gold" or "1 Gold" it would convert that
string to an integer.

But if the user inputs "2 Gold" or "3 Gold" etc. it would return dead.

How do I make it so that it is not limited to numbers 0 and 1?

Thanks!

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