(fsharp/en) List Pattern Matching first element of "many" (#3516)

List Pattern Matching first element of "many"
This commit is contained in:
Divay Prakash 2019-05-11 01:28:30 +05:30 committed by GitHub
commit c521d4d1b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]