1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-07-31 20:10:49 +02:00

Make the two fib functions consistent

This commit is contained in:
Geoff Liu
2015-03-16 14:07:19 -06:00
parent 4562e82c01
commit a81affb302

View File

@@ -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