F#|>;(管道转发)和#x27;let后面的块未完成';错误
请有人帮我理解为什么下面的代码给了我错误“下面的块是未完成的”。需要一个表达式“?x的值应该是一个字符串列表,这就是F#的看法。那么,为什么x不能成为一个字符串列表,以便以后在函数中使用呢F#|>;(管道转发)和#x27;let后面的块未完成';错误,f#,excel-dna,F#,Excel Dna,请有人帮我理解为什么下面的代码给了我错误“下面的块是未完成的”。需要一个表达式“?x的值应该是一个字符串列表,这就是F#的看法。那么,为什么x不能成为一个字符串列表,以便以后在函数中使用呢 let fxProper (str : string) (values : obj[,]) = let x = values |> Seq.cast<obj> |> Seq.filter (fun x -> not (x
let fxProper (str : string) (values : obj[,]) =
let x =
values
|> Seq.cast<obj>
|> Seq.filter (fun x -> not (x :? ExcelEmpty))
|> Seq.map string
|> Seq.toList
让fxProper(str:string)(值:obj[,])=
设x=
价值观
|>序号
|>Seq.filter(乐趣x->not(x:?ExcelEmpty))
|>Seq.map字符串
|>序号:toList
您需要对刚刚设置的x值执行一些操作
let fxProper (str : string) (values : obj[,]) =
let x =
values
|> Seq.cast<obj>
|> Seq.filter (fun x -> not (x :? ExcelEmpty))
|> Seq.map string
|> Seq.toList
x
让fxProper(str:string)(值:obj[,])=
设x=
价值观
|>序号
|>Seq.filter(乐趣x->not(x:?ExcelEmpty))
|>Seq.map字符串
|>序号:toList
x
应该有用
这个
让fxProper(str:string)(值:obj[,])=
价值观
|>序号
|>Seq.filter(乐趣x->not(x:?ExcelEmpty))
|>Seq.map字符串
|>序号:toList
应该也能用。你做得对。
x
的let绑定工作正常。错误是告诉您函数fxProper
当前没有返回任何内容。如果您的目的是返回x,则需要将其添加到fxProper
的末尾,如下图所示,否则只需添加一个伪返回值,直到编写完函数为止
let fxProper (str : string) (values : obj[,]) =
let x =
values
|> Seq.cast<obj>
|> Seq.filter (fun x -> not (x :? ExcelEmpty))
|> Seq.map string
|> Seq.toList
x //this returns the value of x from fxProper, this could also just the default value of whatever you actually want to return here
让fxProper(str:string)(值:obj[,])=
设x=
价值观
|>序号
|>Seq.filter(乐趣x->not(x:?ExcelEmpty))
|>Seq.map字符串
|>序号:toList
x//这将从fxProper返回x的值,这也可能只是您实际想要在此处返回的任何内容的默认值
函数不能以let
绑定结束。您必须从函数中返回一个值。(这可能很明显,但由于您还没有与应答者进行交流,我将把它放进去…x
是fxProper
的本地值。因此,如果您指的是比“函数中的稍后部分”所指的更全局的内容,则需要将其移出其所在的范围
let fxProper (str : string) (values : obj[,]) =
let x =
values
|> Seq.cast<obj>
|> Seq.filter (fun x -> not (x :? ExcelEmpty))
|> Seq.map string
|> Seq.toList
x //this returns the value of x from fxProper, this could also just the default value of whatever you actually want to return here