fib 0 = 1
fib 1 = 1
fib n | n >= 2
= fib (n-1) + fib (n-2)
def fib(0), do: 1
def fib(1), do: 1
def fib(n) when n >= 2, do: fib(n-1) + fib(n-2)
match [head] + tail in [0, 1, 2, 3]:
print(head, tail)
match x with
| Some x => println$ x;
| None => println "NONE";
endmatch;
Languages with Pattern Matching include Rust, Haskell, Elixir, Coconut, HOPE, Felix, NPL
Languages without Pattern Matching include progsbase
Read more about Pattern Matching on the web: 1.
HTML of this page generated by Features.ts