Created
December 2, 2011 16:14
-
-
Save davidgrenier/1423793 to your computer and use it in GitHub Desktop.
Pattern > If example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Status = Active | Standby | Inactive | |
let status = Active | |
let isOnline = true | |
if not isOnline then | |
printfn "Status is offline or inactive" | |
else | |
match status with | |
| Active -> "Status is active" | |
| Standby -> "In Standby" | |
| Inactive -> "Status is offline or inactive" | |
|> printfn "%s" | |
// vs | |
printfn <| | |
match isOnline, status with | |
| false, _ | _, Inactive -> "Status is offline or inactive" | |
| _, Active -> "Status is active" | |
| _, Standby -> "In Standby" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment