Undefined method `-' for nil:NilClass


#1



class Computer
    @@users= {}
    
    def initialize(username, password)
        @username= username
        @password- password
        @@users[username]= password
        @files= {}
    end
    
    def create(filename)
        time= Time.now
        @files[filename]= time
        puts "New file was created"
    end
    
    def Computer.get_users
    @@users
    end
end

my_computer = Computer.new("test","test2")

Hi can someone tell me what's wrong with this code? The error message reads undefined method `-' for nil:NilClass


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.