So, what I try to do is to define recursively a function that calculates how much money I have after n years, if I start with an amount a and receive p percent of interest per year.
interest (n,a,p)
| n > 0 = interest (n-1,a,p)
where a = (a*p)/100
| otherwise = a
And it gives me this error:
E:\\Module1\week3\scripts.hs:35:2: error: parse error on input `|'
|
35 | | otherwise = a
| ^
Can anyone tell me what I do wrong? Thank you.
interest n a p = ..., and thus called withinterest (n-1) a p.