这是F#Builder的bug还是我的误解?
当我尝试控制台编程时,我收到了意想不到的结果这是F#Builder的bug还是我的误解?,f#,F#,当我尝试控制台编程时,我收到了意想不到的结果 open System let printSomeMessage = printfn "Is this the F# BUG?" [<EntryPoint>] let main args = if args.Length = 2 then printSomeMessage else printfn "Args.Length is n
open System
let printSomeMessage =
printfn "Is this the F# BUG?"
[<EntryPoint>]
let main args =
if args.Length = 2 then
printSomeMessage
else
printfn "Args.Length is not two."
0
我是否缺少一些语法或F#特征?还是F#builder的BUG?不,这是代码中的BUG。您需要在“printSomeMessage”之后添加括号,否则printSomeMessage是一个简单的值,而不是一个函数
open System
let printSomeMessage() =
printfn "Is this the F# BUG?"
[<EntryPoint>]
let main args =
if args.Length = 2 then
printSomeMessage()
else
printfn "Args.Length is not two."
0
很明显,我能理解!非常感谢。没问题,很高兴我的回答有帮助。
Is this the F# BUG?
Args.Length is not two.
open System
let printSomeMessage() =
printfn "Is this the F# BUG?"
[<EntryPoint>]
let main args =
if args.Length = 2 then
printSomeMessage()
else
printfn "Args.Length is not two."
0
let x = 1
let y = "my string"