F# is the latest addition to the Microsoft Visual Studio language family. There are many exciting reasons to learn F#, such as clean syntax, powerful multi-threading capabilities, and interoperability with other Microsoft .NET Framework languages.
The two major differences between F# syntax and a standard C-like syntax are:
Some developers think that the F# syntax is very clear and straightforward when you get used to it, and in many ways, it is simpler than the C# syntax, with fewer keywords and special cases.
Let's consider the following lines of code.
let myInt = 5 let myFloat = 3.14 let myString = "hello"
let keyword defines an immutable value. The
let keyword also defines a named function, as shown below.
let square a = a * a square 5
F# provides two types of comments.
(*and ends with
The following example shows a single line and multi-line comments.
open System // It is a single line comment let message = "Welcome to F# Tutorial." (* This is a comment line another comment line Sample program using F# *) [<EntryPoint>] let main argv = Console.WriteLine(message) 0 // return an integer exit code