Top 1,000 Features Creators Resources Blog Explorer Download
GitHub icon

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, Felix, Egison, HOPE, Aardvark, NPL

*

Languages without Pattern Matching include progsbase

*

View all concepts with or missing a hasPatternMatching measurement

*

Read more about Pattern Matching on the web: 1.

View source

- Build the next great programming language About Acknowledgements Extensions Day 630 Donate feedback@pldb.io