F# 中的条件运算符 (A?B:C)

Conditional Operator in F# (A?B:C)

在 C# 中,我们有条件运算符:

[condition] ? [value if true] : [value if false]

但我似乎无法在 F# 中找到它。它存在吗?

据发现here答案是

C# has the ternary operator "?:" for conditional expressions:

condition ? trueVal : falseVal 

F# has the same operator, but its name is if-then-else:

if condition then trueVal else falseVal

(Note that "if" is used much less frequently in F# than in C#; in F#, many conditionalexpressions are done via pattern-matching rather than if-then-else.)

我链接的网站提供了一堆 C# 与 F# 示例。