Basic Syntax FSharp

Here is a very quick overview on how to read F# code for newcomers unfamiliar with the syntax.

It is obviously not very detailed but should be enough so that you can read and get the gist of the upcoming examples in this series. Don’t worry if you don’t understand all of it, as I will give more detailed explanations when we get to the actual code examples.
Personally, I think that the F# syntax is very clear and straightforward when you get used to it. In many ways, it is simpler than the C# syntax, with fewer keywords and special cases.

The example code below is a simple F# script that demonstrates most of the concepts that you need on a regular basis.
Type this into a F# script file (with .fsx extension) and send it to the interactive window.
Alternatively, try running this code in the interactive window. Remember to always use ;; at the end to tell the interpreter that you are done entering and ready to evaluate.

 

Please follow and like us:

Leave a Reply