Skip to content

Instantly share code, notes, and snippets.

@davidgrenier
Created November 21, 2011 14:24
Show Gist options
  • Select an option

  • Save davidgrenier/1382757 to your computer and use it in GitHub Desktop.

Select an option

Save davidgrenier/1382757 to your computer and use it in GitHub Desktop.
NegativePositiveZero
let (|Negative|Positive|Zero|) x =
if x > 0 then Positive
else if x < 0 then Negative
else Zero
let count = -2;;
match count with
| Zero | Negative -> printfn "Zero or less"
| Positive -> printfn "Greater than zero"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment