1
Ich möchte überprüfen, ob ein Tier eine Person ist und ihr Name ist Alex.Enumeration mit spezifischen Typ und Eigenschaft
Person Objekt:
type Person(name: string) =
member this.Name = name
Enumration:
type Animal =
| Person of Person
| Cat
| Dog
Pattern Matching:
let KnowAnimal animal =
match animal with
| Person person && person.Name = "Alex" -> 1
| Cat -> 2
| Dog -> 3
| _ -> 4