i try to become familiar with the if-condition statements in haskell

assume that i´ve an argument x and i try the following in haskell

```
functionname x = if x > 0 then x-5
if x-5 == 0 then 1
else if x-5 /= 0 then functionname x-5
else if x-5 < then 0
```

so, the idea was to subtract 5 from x, check if the result is 0, if yes, then give a 1. If not then invoke the function again with the expression x-5. If the result of x-5 is negative then give a 0.

so, my questions: Would that be correct? Because when i try that, i´ve got a message like parse error on input 'functionname'.

how can i fix that problem? Are the if-else conditions wrong ?

```
programm :: Int -> Bool
programm x | x > 0 =
if z == 0 then True
else if z < 0 then False
else programm z
where
z = z-2
programm x | x < 0 =
if z == 0 then True
else if z > 0 then False
else programm z
where
z = z+2
```

so, i wanted to have the possibility to decide of a given number is even. So, i modify your solution a little bit. its the same but, at the beginning of the two declarations i said : x > 0 = .... and x < 0 =... Because i want to say that for example -4 is also even. for that reason: the first declarations should handle the positive even numbers and the second declarations handles the negative even numbers.

when i give that to the compiler, then the message : Exception appears. Where i ve made the mistake?

`if`

in Haskell needs an`else`

. – n.m.