mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Make the two fib functions consistent
This commit is contained in:
parent
4562e82c01
commit
a81affb302
@ -148,7 +148,7 @@ add 1 2 -- 3
|
||||
|
||||
-- Guards: an easy way to do branching in functions
|
||||
fib x
|
||||
| x < 2 = x
|
||||
| x < 2 = 1
|
||||
| otherwise = fib (x - 1) + fib (x - 2)
|
||||
|
||||
-- Pattern matching is similar. Here we have given three different
|
||||
|
Loading…
Reference in New Issue
Block a user