I need a simple function that gives the opposite value - return v2, if v == v1; return v1 if v == v2. I tried the following:
let oppose v v1 v2 =
match v with
| v1 -> v2
| v2 -> v1
| _ -> ""
But I get warnings:
warning FS0026: This rule will never be matched
warning FS0026: This rule will never be matched
And this does not work as expected:
> oppose "a" "a" "b"
val it : string = "b"
> oppose "b" "a" "b"
val it : string = "b"
I would expect to get an "a" in the second call. What am I doing wrong?
source
share