4- Display the balance (what's wrong with my code)


#1

Hello there, I'am really stuck and would very much appreciate any help. I have tried everything and still getting error messages. even just copying the example itself is not working! here is my cold.

class Account
    attr_reader :name, :balance
    def initialize (name, balance=100)
        @name= name
        @balance= balance
    end
    
    private
    def pin
        @pin = 1234
    end
    def pin_error
    "Access denied: incorrect PIN."
    end
    
    public
        
    def display_balance(pin_number)
    if pin_number== pin? puts "Balance : $#{@balance}."           else pin_error
    end
    
end

Thanks folks.


#2

I just put a space between pin_number == pin and ? and it worked !!!
and the error in the consol didn't point out to it. I am quite a bit confused. any comment so that I can make it a learning experience?
Thanks angain anyway.