问题
In C code, it would be like this:
if (c != 0) { //some code ...}
what about in F#?
回答1:
From MSDN's page on F# arithmetic operators, it looks like you want x <> 0
.
回答2:
I think what you're looking for is the F# not operator or the <> operator for inequality.
回答3:
In addition to the other answers, you can also use pattern matching:
match c with
| 0 -> () //do nothing
| _ -> ... //do something
回答4:
<> is used for inequality
(1<>2)
来源:https://stackoverflow.com/questions/9130181/what-is-the-f-syntax-for-not-equal-to