我希望用户输入他们的胡须风格,然后我将根据一系列胡须风格中的胡须列表对其进行检查。这是我想做的额外事情,我不知道如何解决。我遇到的唯一一项接近它的东西是(包括?)但我想拥有:
(数组名).include? (用户输入的值)
require_relative 'list_of'
require_relative 'error'
#User inputs a value
def get_beard
puts "What style of beard do you have?"
beard = gets
if check_beard_ok?(beard)
then no_problem(beard) end
end
#Value passed to check length doesn't exceed 25 letters
def check_beard_ok?(beard)
# while beard.length < 25
# beard.in?(beard_style)
# end
end
#The value is printed here without any errors occuring
def no_problem(beard)
puts "\nYou have a " + beard
puts "\nThere are other beards that you could try like..."
list_of
end
get_beard