I am getting the following error:
Can't convert String into Integer (TypeError)
It is happening on this line:
if new_animal != animals[i]
Why is this happening?
animals = ['rhino', 'giraffe', 'cat', 'dolphin', 'turtle']
puts 'Enter the new animal:'
new_animal = gets.chomp
empty_array = []
animals.each do |i|
if new_animal != animals[i]
empty_array << i
end
end