I am having problems with the following exercise:
Write a function that that receives three Int's and that sums them if they are all positive and returns 0 (zero) otherwise.
What I have done is the following:
sum' :: int -> int -> int -> int
sum' x y z = if x >= 0, y >= 0, z >= 0 then x+y+z else 0
I don't know how to make multiple conditions on an if, not sure if this is done with logical "connectors" ( like || && in Java) or if it is done in a similar way to the one I made.
Aucun commentaire:
Enregistrer un commentaire