类型' int'不支持运营商' =='

时间:2015-03-16 06:51:36

标签: f#

我想像这样计算binom:

let t = seq { 1..10 } |> Seq.takeWhile (fun e -> e % 2 == 0)

但编译器抱怨

playground.fsx(27,59): error FS0001: The type 'int' does not support the operator '=='

我做错了什么?

1 个答案:

答案 0 :(得分:15)

F#对单个=使用等于运算符:

let t = seq { 1..10 } |> Seq.takeWhile (fun e -> e % 2 = 0)