OR Pattern in Pattern Matching Expression

Hi :wave:

Is there something like the OR Pattern in a Pattern Matching Expression?

(ps: I also added a link to the PS Doc to see if it could be exemplified)

2 Likes

You can get a similar result with guards:

detectZeroOr :: Tuple Int Int -> String
detectZeroOr = case _ of
  Tuple x y
    | x == 0 || y == 0 -> "Zero found."
    | otherwise -> "Both nonzero."

You can play around with a code example of the above here.

3 Likes