mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 10:01:38 +00:00
(fsharp/en) List Pattern Matching first element of "many" (#3516)
List Pattern Matching first element of "many"
This commit is contained in:
commit
c521d4d1b8
@ -194,7 +194,7 @@ module ListExamples =
|
||||
| [] -> printfn "the list is empty"
|
||||
| [first] -> printfn "the list has one element %A " first
|
||||
| [first; second] -> printfn "list is %A and %A" first second
|
||||
| _ -> printfn "the list has more than two elements"
|
||||
| first :: _ -> printfn "the list has more than two elements, first element %A" first
|
||||
|
||||
listMatcher [1; 2; 3; 4]
|
||||
listMatcher [1; 2]
|
||||
|
Loading…
Reference in New Issue
Block a user