summaryrefslogtreecommitdiffhomepage
path: root/fsharp.html.markdown
diff options
context:
space:
mode:
authorJeff Parent <jeff@commentedcode.org>2019-04-14 01:41:21 -0500
committerGitHub <noreply@github.com>2019-04-14 01:41:21 -0500
commitd9b80337ba915040c9e019db79b1ce62c736c4db (patch)
tree1a83d65772bf30903cd3547356e2034cd2238ab6 /fsharp.html.markdown
parent2dde374091366cb098e5d405daa9c4c4c469b6dc (diff)
List Matching first element of "many"
Updated the pattern matching for lists to show how to get head of a list when you don't care how many other elements are in the list.
Diffstat (limited to 'fsharp.html.markdown')
-rw-r--r--fsharp.html.markdown2
1 files changed, 1 insertions, 1 deletions
diff --git a/fsharp.html.markdown b/fsharp.html.markdown
index 59461eed..24044d76 100644
--- a/fsharp.html.markdown
+++ b/fsharp.html.markdown
@@ -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]