Learn
Banking on Ruby

Making a Withdrawal

Well done! Now let's add in our second public method, which will allow us to withdraw money from our account.

The trick to this one is to realize that since @balance can only be accessed from inside the class, we'll want to use @balance -= amount to decrease the balance by a certain amount.

Report a Bug
If you see a bug or any other issue with this page, please report it here.
Code Editor