From dcfbeeb614c92498c14b02f3b6840c52558e7c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20H=C3=B6tzel?= Date: Sat, 12 Nov 2016 18:29:18 +0100 Subject: [fsharp/en] Use "elif" (#2566) --- fsharp.html.markdown | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'fsharp.html.markdown') 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 -- cgit v1.2.3