Making a withdrawal


#1



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
        end
    
def withdraw(pin_number, amount)
    if pin_number == pin 
        @balance -= amount
        puts "Withdrew: #{amount}. New balance: $#{@balance}."
    else 
        puts pin_error
end
end


#2

A ternary expression does not have if, but ?

condition ? if true : if false

#3

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