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