What is the F# syntax for “not equal to”?

亡梦爱人 提交于 2020-01-03 07:19:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!