F#忽略缺失忽略

F#忽略缺失忽略,f#,fsi,F#,Fsi,我经常以互动的方式使用F#。我在VisualStudio的脚本文件中键入语句,然后按Alt+Enter,在F#Interactive中执行它们。 我经常看到这样的警告:我忽略了表达式的结果。我当然不是,因为我以交互方式评估一切 是否有关闭此警告的选项 例如: let numbers = "151,160,137,91,90,15" numbers.ToCharArray() |> Array.filter (fun e-> e=',') |> Array.length F#

我经常以互动的方式使用F#。我在VisualStudio的脚本文件中键入语句,然后按
Alt+Enter
,在F#Interactive中执行它们。 我经常看到这样的警告:我忽略了表达式的结果。我当然不是,因为我以交互方式评估一切

是否有关闭此警告的选项

例如:

let numbers = "151,160,137,91,90,15"
numbers.ToCharArray() 
|> Array.filter (fun e-> e=',')
|> Array.length
F#Interactive有多种功能,包括一个用于抑制编译器警告消息的功能:

--nowarn:<warning-list>
F#交互式返回

Script.fsx(9,7): warning FS0025: Incomplete pattern matches on this expression. 
For example, the value '[]' may indicate a case not covered by the pattern(s).

Microsoft.FSharp.Core.MatchFailureException: 
The match cases were incomplete at <StartupCode$FSI_0003>.$FSI_0003.main@() in
   C:\Users\Eric\Documents\Visual Studio2015\Projects\Workspace\Library2\Script.fsx:line 9 
Stopped due to error
Microsoft.FSharp.Core.MatchFailureException: 
The match cases were incomplete at <StartupCode$FSI_0004>.$FSI_0004.main@() in 
  C:\Users\Eric\Documents\Visual Studio 2015\Projects\Workspace\Library2\Script.fsx:line 9
Stopped due to error
F#交互式返回

Script.fsx(9,7): warning FS0025: Incomplete pattern matches on this expression. 
For example, the value '[]' may indicate a case not covered by the pattern(s).

Microsoft.FSharp.Core.MatchFailureException: 
The match cases were incomplete at <StartupCode$FSI_0003>.$FSI_0003.main@() in
   C:\Users\Eric\Documents\Visual Studio2015\Projects\Workspace\Library2\Script.fsx:line 9 
Stopped due to error
Microsoft.FSharp.Core.MatchFailureException: 
The match cases were incomplete at <StartupCode$FSI_0004>.$FSI_0004.main@() in 
  C:\Users\Eric\Documents\Visual Studio 2015\Projects\Workspace\Library2\Script.fsx:line 9
Stopped due to error
这是您要与
#nowarn
一起使用的警告代码的最后几位,请不要忘记数字周围的引号

因此,对于FS0025来说,它是
#nowarn“25”

非常感谢#诺瓦恩“0020”做到了!:-)写一个答案#nowarn“20”修复了“绑定结果!”-警告:-)
warning FS0025