我引用了这个link。但是,我仍然没有看到我如何能够或以下的工会案例:
match count with
| x when x < 2 -> grid |> setCell { X=x; Y=y; State=Dead }
| x when x > 3 -> grid |> setCell { X=x; Y=y; State=Dead }
| _ -> grid
我想这样做:
match count with
| x when x < 2
| x when x > 3 -> grid |> setCell { X=x; Y=y; State=Dead }
| _ -> grid
这可能吗?
答案 0 :(得分:4)
使用布尔OR运算符||
match count with
| x when x > 3 || x < 2 -> grid |> setCell { X=x; Y=y; State=Dead }
| _ -> grid
答案 1 :(得分:3)
如何反转比赛?
match count with
| 1
| 2 -> grid
| _ -> grid |> setCell { X=count; Y=y; State=Dead }