F#
==

F# is a strongly typed, multi-paradigm programming language that encompasses functional, imperative, and object-oriented programming techniques.

All the snippets included here can be run online at: http://www.tryfsharp.org/Learn
(exception: FSI snippet).

**Length 8 Snippet**

    [-9..10]

F# allows to define ranges of sequential values. This snippet generates a list of 20 integer elements, -9 and 10 inclusive.

You can define stepping values, for example `[0..10..50]` will yield a list of 6 elements: **[0; 10; 20; 30; 40; 50]**.

Ranges also work for arrays.

**Length 7 Snippet**

    let a=1

We can now define **values**. Values in F# are immutable by default, that is the reason we avoid the use of the term "variable".

The snippet defines an immutable value "a" that contains a 1 (integer).
	
**Length 6 Snippet**

    2.**8.

Now we can use the Power function.

Note that I could not call the Power function before with arguments "2" and "8", because [the arguments] would be considered integers. The decimal points make the compiler to infer a floating point number. This snippet correctly returns a 256.0 (float) value.

Floats in F# are double precision.

**Length 5 Snippet**

    [|0|]

At five characters, we can define an array with one element (as mentioned before, the compiler infers the type to `int[]`). 

Not to be confused with a list. An empty list is defined simply by the square brackets like this: `[]`

The element separator, in both lists and arrays, is the semicolon (`;`) as in `[| 1;2;3 |]`

**Length 4 Snippet**

    (**)

It's not an emoticon, it is a multi-line comment in F#. For some odd reason I didn't find this syntax intuitive. I got used to it until much later.

Single-line comments are double-slash (`//`), just like C++, C#, Java, etc.

**Length 3 Snippet**

    nan

Three characters unlocks many basic arithmetic operations (**1+2**, **9*9** and so on). But I picked `nan`. It is a shortcut function that simply returns System.Double.NaN. 

Useful to compare (or match) the result of a function.

**Length 2 Snippet**

    ;;

I could've used an empty string (`""`) as the snippet. That would create a function that returns an empty string, but it is the same concept as the length 1 snippet.

Instead, I picked the empty statement in **F# Interactive (FSI)**. FSI is a REPL tool that allows you to declare, construct and otherwise experiment with your code in an interactive manner and it is very useful. In my opinion, the `;;` is used more frequently than empty strings.

You must append double semicolons (`;;`) at the end of your statements in FSI to indicate the end of input.

**Length 1 Snippet**

    0

A function that returns zero (the compiler infers the type to integer). Commonly used as the final statement to return the program exit code.

**Factoid**: F# uses type inference. The programmer does not need to declare types - the compiler deduces types during compilation.