Last active
July 1, 2024 12:43
-
-
Save espio999/a8c7a8c8f8f880616d524edbb7c09c56 to your computer and use it in GitHub Desktop.
F# pattern matching - identifier pattern for practical purpose
This file contains 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
type Money = Money of decimal | |
let calcTax (price: Money) = | |
let price = match price with Money p -> p | |
Money (price * 0.1m) | |
let p = Money 100m | |
calcTax p |> printfn "%A" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment