For the processing of def ~ end If there is a number you want to pass from outside the process appear.
Declare what variable you want to pass first, Just add the variable you want to pass to the variable you receive.
def show_review
line = "---------------------------"
puts "Genre: #{genre}\n#{line}\n"
puts "title: #{title}\n#{line}\n"
puts "Impressions:\n#{impression}\n#{line}\n"
end
genre = "aaa"
title = "qqq"
impression = "ddd"
review.show_review
① In "genre" "title" "impression" in "review.show_review" Pass the value ② An error occurs in the scope ③ Add (genre, title, impression) to "review.show_review" ④ In addition, add (genre, title, impression) to the handed side as well. ⑤ You can hand it over! !!
def show_review (genre,title,impression)← ② Add recipients
line = "---------------------------"
puts "Genre: #{genre}\n#{line}\n"
puts "title: #{title}\n#{line}\n"
puts "Impressions:\n#{impression}\n#{line}\n"
end
genre = "aaa"
title = "qqq"
impression = "ddd"
review.show_review(genre,title,impression)← ① Add the item you want to pass
Recommended Posts