mercredi 18 septembre 2019

I need to answer the following question in Haskell: Defines a function that lets you see if the integer m is a multiple of n

I cannot have a correct use of if-sentences and I get the error "parse error (possibly incorrect indentation or mismatched brackets)".

I've tried to use different if-sentences, but my experience is in Imperative Language, so I really don't know how to use properly the if-sentences in Haskell

multiple m n = mod m n
if mod m n /= 0 then "not multiple"

OR

multiple m n = mod m n
if mod m n = 0
then putStrLn "multiple"

OR

if multiple m n = 0 then "multiple m n" = "multiple"

And another amount of things

I expected to get an answer like "Multiple" or "Not Multiple". Please help me :(

Aucun commentaire:

Enregistrer un commentaire