def select(prompt, items = [])
  if items.empty?
    ''
  else
    answer = -1
    until (0...items.length).cover?(answer)
      items.each_with_index {|i,j| puts }
      print 
      begin
        answer = Integer(gets)
      rescue ArgumentError
        redo
      end
    end
    items[answer]
  end
end


response = select('Which is empty')
puts 


items = ['fee fie', 'huff and puff', 'mirror mirror', 'tick tock']
response = select('Which is from the three pigs', items)
puts