だから私はコードを持っています:
puts 'What is your name?(Enter in field below)'
input = gets.chomp
puts 'end'
occupationslist = ['Engineer', 'Clerk', 'Doctor', 'Demolition Expert', 'Athlete', 'None',]
oclistlength = occupationslist.length
rand1 = rand(oclistlength)
occupation = ocupationslist[rand1]
def occupations
puts input
puts 'Occupation: ' + occupation
puts 'Rating: ' + rand(1-12).to_s
end
occupations
あなたの名前(入力したもの)、ランダムな職業、ランダムな評価が表示されるはずですが、何が問題なのかわかりません。これは満足のいく出力です:
prints "What is your name?".
(gets user input)
prints out the input.
prints out a random 'occupation'(from the list in the array above).
prints out the 'Rating: ' - a random number from 0 to 12.