diff options
-rw-r--r-- | fsharp.html.markdown | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fsharp.html.markdown b/fsharp.html.markdown index 69f4eb60..bbf477ba 100644 --- a/fsharp.html.markdown +++ b/fsharp.html.markdown @@ -408,11 +408,14 @@ module ActivePatternExamples = // "banana clips" are the syntax for active patterns + // You can use "elif" instead of "else if" in conditional expressions. + // They are equivalent in F# + // for example, define an "active" pattern to match character types... let (|Digit|Letter|Whitespace|Other|) ch = if System.Char.IsDigit(ch) then Digit - else if System.Char.IsLetter(ch) then Letter - else if System.Char.IsWhiteSpace(ch) then Whitespace + elif System.Char.IsLetter(ch) then Letter + elif System.Char.IsWhiteSpace(ch) then Whitespace else Other // ... and then use it to make parsing logic much clearer |