Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- The Account table.
- Account = {balance = 0}
- -- The withdraw function.
- function Account.withdraw(self,v)
- self.balance = self.balance - v
- end
- -- Print the first balance of both accounts.
- print(" ------------ First Check -------------")
- print(" Jasper's Balance: "..Jasper.balance)
- print(" Gerry's Balance: "..Gerry.balance)
- print(" --------------------------------------")
- -- Take 20 of Jasper's balance, 2000000 of Gerry's balance
- Account.withdraw(Jasper, 20)
- Account.withdraw(Gerry, 2000000)
- -- Print the second balance of both accounts.
- print(" ------------ Second Check ------------")
- print(" Jasper's Balance: "..Jasper.balance)
- print(" Gerry's Balance: "..Gerry.balance)
- print(" --------------------------------------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement