下面是一些代码在F#中,我试过按照编程F#byChris Smith的书:
(*
Mega Hello World:
Take two command line parameters and then print
them along with the current time to the console.
*)
open System
[<EntryPoint>]
let main (args : string[]) =
if args.Length <> 2 then
failwith "Error: Expected arguments <greeting> and <thing>"
let greeting, thing = args.[0], args.[1]
let timeOfDay = DateTime.Now.ToString("hh:mm tt")
printfn "%s, %s at %s" greeting thing timeOfDay
// Program exit code
0
main(["asd","fgf"]) |> ignore
Run Code Online (Sandbox Code Playgroud)
在main中有一个错误说:这个表达式应该有'String []'类型,但是这里输入"list".但是string []是一个字符串数组.所以我不明白我的错误.
f# ×1