An error occurs on the command line.

'+': no implicit conversation of fixnum into array <TypeError> from test.rb:117:in 'block <main>' from test.rb:107:in 'each' from test.rb:107:in '<main>' 

Below line 107-119:

 for item in questions_yes do puts item user_input = nil while (user_input != "yes" and user_input !="no" ) puts "#{name}, введите ответ yes или no" user_input = STDIN.gets.chomp.downcase end if (user_input == "yes") correct_answers += 1 end end 
  • And correct_answers you do not have an array, by any chance? - VenZell
  • Thank you, VenZell. It turned out that there was an array, removed the square brackets, and everything worked perfectly - user219793
  • You are welcome. I made my comment as a response. If he helped you, please mark him faithfully. - VenZell
  • FYI: in Ruby it is customary to use array.each do |i| instead of for i in array do . - D-side

1 answer 1

The problem is that you are trying to add an array with an integer in this line:

 correct_answers += 1