Before we get into recursion, we need to see some basic expressions first, so that you can increase your portfolio. The first one we will see is “if then else”. This is a logical expression, basically it means: If something then something or else other thing. Example:
|
1 2 3 4 5 |
isOne :: Int -> Bool isOne x = if x==1 then True else False one :: Int -> Int one x = if x==1 then 1 else 0 |
When you have if something then True [...]