Created
November 28, 2011 21:18
-
-
Save timruffles/1402117 to your computer and use it in GitHub Desktop.
bank account closure demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BankAccount = (balance = 0) -> | |
| (cmd, amount = 0) -> | |
| if cmd == "withdraw" then BankAccount balance - amount | |
| else if cmd == "deposit" then BankAccount balance + amount | |
| else if cmd == "balance" then balance.toFixed 2 | |
| else "What kind of person would try to #{cmd} a bank account?" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment