#眉標=F#程式設計 #副標=F#程式設計入門(1) #大標=走進Functional Programming的世界 #作者=文/蔡學鏞 ==<反灰>=========== let x = "Hello World";; System.Console.WriteLine(x);; ================ ==<反灰>=========== C:\>fsc hello.fs ================ ==<反灰>=========== C:\>Hello.exe Hello World ================ ==<反灰>=========== > let x = "Hello World";; val x = string > System.Console.WriteLine(x);; Hello World val it : unit = () ================ ==<反灰>=========== #light open System open System.Windows.Forms let form = new Form() form.Width <- 400 form.Height <- 300 form.Visible <- true form.Text <- "Hello World Form" // Menu bar, menus let mMain = form.Menu <- new MainMenu() let mFile = form.Menu.MenuItems.Add("&File") let miQuit = new MenuItem("&Quit") mFile.MenuItems.Add(miQuit) // RichTextView let textB = new RichTextBox() textB.Dock <- DockStyle.Fill textB.Text <- "Hello World\n\nOK." form.Controls.Add(textB) // callbacks miQuit.Click.Add(fun _ -> form.Close()) #if COMPILED // Run the main code. The attribute marks the startup application thread as "Single // Thread Apartment" mode, which is necessary for GUI applications. [] do Application.Run(form) #endif ================