Created
March 24, 2020 18:47
-
-
Save escamoteur/d82cbeb031d05fb690252498530db830 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