(ruby):15: warning: else without rescue is useless


#1



can you check my code?

https://www.codecademy.com/en/courses/ruby-beginner-en-32cN3/0/4?curriculum_id=5059f8619189a5000201fbcb


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


#2

Hi this part

def display_balance (pin_number)
    if pin_number == pin
        puts "Balance: $#{@balance}."
    end
    else
        puts pin_error
    end

the end you put after the if statement should be at the end like that

def display_balance (pin_number)
    if pin_number == pin
        puts "Balance: $#{@balance}."
    else
        puts pin_error
    end #close the if and else statement
end #close the function