Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
type Order(selectedPaymentMethod: PaymentMethod,
discountCode: Option<string>) =
let paymentMethod pm =
match pm with
| x when x = CashOnDelivery ->
printfn "Cash on delivery"
| Paypal id->
printf "paid by paypal %A" id
| Card (cardNumber , cardType) ->
printf "paid by %A%A" cardNumber cardType
let printPaymentMethod = paymentMethod (selectedPaymentMethod)
member val PaymentMethod: PaymentMethod = paymentMethod with get
//other members removed for brevity
printfn "%A" printPaymentMethod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.