How to store data taken from user and store it in array? (in ruby) : I am developing a hospital management system on command line using ruby. In this, i take values from the user and display it. But I want to take value from user in an instance variable and store it in array. However, every time a new value is entered, it overwrites the previous value. The code is as follows:

      def doctor_details
    @doctors = Array.new
    puts 'Enter Doctor Name'
    @doc_name = gets
    @doctors << @doc_name 
    puts 'Enter specialization'
    @doc_specialization = gets
    puts 'Availability of doctor'
    @from = Float(gets)
    @to = Float(gets)
  end