Introduction to F#

F# is a functional programming language for the .NET Framework. This means that F# has access to the .NET Framework APIs and conversely that other .NET languages can use F# libraries. F# programming is basically a combination of three {somethings} Functional Programming as well as Imperative and Object Oriented Programming Concepts. F# is a language which can take advantage of core libraries like Windows Communication Foundations (WCF), Windows Presentation Foundations (WPF) etc. F# runs on the CLR, embraces object oriented programming, and has features to ensure a smooth integration with the .NET Framework. F# has its root in a programming language called OCaml and has the capability to cross compile OCaml code, which means that F# can compile simple OCaml programs without modification.


Paradigms of F#


Advantages of F#

F# is the world's first language which contains the following features:
Getting Started with first F# program

Here we are discussing a simple example in F#, how to print Text in F#.

Step1- First open Visual Studio 2010 then create a project; from the Visual F# category select F# application and from F# Application project Template.

F1.gif

Step 2- when you will click ok it will create a file with a .fs extension in your Solution Explorer like below.

F2.gif

Step 3- To start your code click on the Program.fs file which is displayed in the Solution Explorer. When you click on this file the F# editor will open where you can write your code.

Code For Printing Text

If you want to print text in F# you just need to put your text in a printfn function like below.

F6.gif

Step 5- Write Code in F# editor

// Learn more about F# at http://fsharp.net
printfn "This is My First F# Program"

Here you don't need to put semicolon for termination.

Step 6- Now run your program. You need to press CTRL+F5 to run the F# program.

Output-

Untitled-2f7.gif

Summary

In this article I have provided an introduction to F# with a simple F# example.