rubyでの質問です。まだ初心者です。現在あるスクールのカリキュラムをやっているのですが、
このようなコードで実行すると「show_all_score」が呼び出されるところで
「no implicit conversion of Symbol into Integer (TypeError)」というエラーが出てしまい
上手く出力ができません。
これはどのように改善できますでしょうか?ご教示いただけると幸いです。
ruby
1def input_score 2 a_scores = {} 3 a_scores[:student]=gets.chomp 4 a_scores[:score]=gets.to_i 5 return a_scores 6end 7 8def show_all_score(scores) 9 student = scores[:student] 10 score = scores[:score] 11 12end 13scores = [] 14while true do 15puts "得点を入力しますか?[0]yes[1]no" 16input = gets.to_i 17if input == 0 18 a_score = input_score 19 scores << a_score 20elsif input == 1 21 show_all_score(scores) 22 exit 23end 24end###ヘディングのテキスト

回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。