Making a withdrawal


I am not sure what is going wrong here, as it seems to be correct to me but I keep getting the following error message...

(ruby):34: syntax error, unexpected $end, expecting keyword_end

def display_balance(pin_number)
    if pin_number == pin ? "Balance: $#{@balance}." : pin_error
def withdraw(pin_number, amount)
    if pin_number == pin 
        @balance -= amount
        puts "Withdrew: #{amount}. New balance: $#{@balance}."
        puts pin_error


A ternary expression does not have if, but ?

condition ? if true : if false


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