-
-
Save forki/8ab9d367f6fdab91d5b7e33d9a7d4880 to your computer and use it in GitHub Desktop.
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
let withdrawWithAudit = withdraw |> auditAs "withdraw" Auditing.fileSystem | |
let depositWithAudit = deposit |> auditAs "deposit" Auditing.fileSystem | |
while true do | |
let action = | |
Console.WriteLine() | |
printfn "Current balance is £%M" account.Balance | |
Console.Write "(d)eposit, (w)ithdraw or e(x)it: " | |
Console.ReadLine() | |
if action = "x" then Environment.Exit 0 | |
let amount = | |
Console.Write "Amount: " | |
Console.ReadLine() |> Decimal.Parse | |
// Mutate account value via an expression | |
account <- | |
if action = "d" then account |> depositWithAudit amount | |
elif action = "w" then account |> withdrawWithAudit amount | |
else account |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment