该语句是正确的,直到最后一个省略号,然后出现错误“预期具有类型单位”
type BankAcc = {AccNum:int; mutable Balance:float} with
member this.Withdraw(amount,?withdrawal) =
let withdrawAmount = this.Balance * float amount
match withdrawal with
| None -> withdrawAmount
| Some deduct -> withdrawAmount - deduct
let Account ={AccNum=123;Balance = 15.00}
Account.Withdraw(25.00) // withdrawing 25 from an account with a balance of 15
let test Balance withdrawAmount =
if Balance = withdrawAmount then "Equals"
elif Balance < withdrawAmount then "Balance too low"
else Balance - withdrawAmount
Account={AccNum =0001; Balance=0.00};
let CheckAccount Balance =
if …Run Code Online (Sandbox Code Playgroud)