Undefined method `-' for nil:NilClass

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

```

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

<do not remove the three backticks above>

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