Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Pattern Matching

< >
Example from 1 languages: Haskell
fib 0 = 1 fib 1 = 1 fib n | n >= 2 = fib (n-1) + fib (n-2)
Example from 1 languages: Elixir
def fib(0), do: 1 def fib(1), do: 1 def fib(n) when n >= 2, do: fib(n-1) + fib(n-2)
Example from 1 languages: Coconut
match [head] + tail in [0, 1, 2, 3]: print(head, tail)
Example from 1 languages: Felix
match x with | Some x => println$ x; | None => println "NONE"; endmatch;
Example from 1 languages: Aardvark
This functionality is included in switch statements.
*

Languages with Pattern Matching include Rust, Haskell, Elixir, Coconut, MoonBit, Felix, Egison, HOPE, Aardvark, NPL

*

Languages without Pattern Matching include progsbase, Veryl

*

View all concepts with or missing a hasPatternMatching measurement

*

Read more about Pattern Matching on the web: 1.

- Build the next great programming language · Add · Issues · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements