Reputation: 12107
I have these two lines:
if not start.IsNone && not stop.IsNone then
let times = TimeArray start.Value stop.Value interval
Is there a cleaner way to do this? if it's a single value, I can use match, but what about 2 values? (F# day 3 here..)
Upvotes: 3
Views: 41
Reputation: 1593
You can still use pattern matching. Consider this quite meaningless example which can help you understand the overall pattern.
let start = Some 1
let stop = Some 2
let res =
match start, stop with
| Some _a, Some _b -> (_a,_b)
| _, _ -> (0, 0)
Upvotes: 4