前提・実現したいこと
localhost/3000で['サ', 'ク', 'ラ', 'サ', 'ク']をRubyのrandを使用して、ランダムな値を生成し、配列の中から文言を取得させなさいと課題を出されたのですが。全く分かりません。
発生している問題・エラーメッセージ
/Users/sakura/camp/greeting/app/controllers/comments_controller.rb:7: syntax error, unexpected keyword_end end ^~~ /Users/sakura/camp/greeting/app/controllers/comments_controller.rb:11: syntax error, unexpected keyword_end end ^~~ /Users/sakura/camp/greeting/app/controllers/comments_controller.rb:21: syntax error, unexpected '=', expecting ';' or '\n' random = ["サ" , "ク... ^ /Users/sakura/camp/greeting/app/controllers/comments_controller.rb:25: syntax error, unexpected end-of-input, expecting keyword_end
該当のソースコード
Ruby,
def
random = ["サ" , "ク" , "ラ" , "サ" , "ク"]
@random = Random.new(0..3)
puts random
end
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/11 14:09