type Suit =
| Club
| Diamond
| Heart
| Spade
member this.ToLatin() =
match this with
| Club -> "Wand"
| Diamond -> "Coin"
| Heart -> "Cup"
| Spade -> "Sword"
Let's check on F# interactive.
> let card = Club;; val card : Suit = Club > card.ToLatin() val it : string = "Wand" > let card2 = Heart val card2 : Suit = Heart > card2.ToLatin() val it : string = "Cup"
No comments:
Post a Comment