Chapter 1. Introduction to F#
F# is a powerful language that spans multiple paradigms of development. This chapter provides a brief introduction to the heart of F#—the F# compiler, tools, and its place in Visual Studio 11.
In this chapter, you will create a couple of simple F# applications, and then I’ll point out key Visual Studio features for F# development. I won’t cover much of Visual Studio here, so I encourage you to explore the IDE on your own.
If you are already familiar with Visual Studio, you should still skim through this chapter. Creating and debugging F# projects works just like C# or VB.NET; however, F# has a unique characteristic when it comes to multiple-file projects. In addition, F# has a feature called F# Interactive that will dramatically increase your productivity. Not to be missed!
Getting to Know F#
As with all programming books, it is customary to write a Hello, World application, and I don’t want to deviate from tradition. Open up Notepad or your favorite text editor and create a new file named HelloWorld.fs with the following text:
// HelloWorld.fsprintfn"Hello, World",
Success! You’ve just written your first F# program. To compile this
application, use the F# compiler, fsc.exe,
located in the Program Files (x86)\Microsoft
SDKs\F#\3.0\Framework\v4.0 folder. (Don’t worry, you won’t have
to remember that.)
The following snippet shows calling the F# compiler on the command line to build and run your application:
C:\Programming F# Source\Ch01>fsc HelloWorld.fs Microsoft ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access