Tuesday, January 6, 2009

F# Basics .

To learn new language we need to first Learn Language Syntax , how to define variables  , Input and output etc.

image

F# has it roots that is called OCaml [ Want to know more about  OCaml  OCaml].

F#  Command line compiler  is  fsc.exe.

Source code file with extensions .fs.

Comments
Block comments are delimited by (* and *) and may be nested. Single-line comments begin with // and extend
to the end of a line

 

Here is the sample  F# program.

[image[30].png]

 

here first line  #light (pronounced hash-light) is a compiler directive that simplifies the syntax of the language.

The #light syntax option is not the default for F# code because F# has its roots in the Caml family of
programming languages and has the ability to cross-compile OCaml code, meaning that it can compile
simple OCaml programs unmodified. This ability however, means that the #light syntax option must be
enabled explicitly. [ Source: Microsft]

let Result =[1..200]  here we are declaring a list of numbers 1 to 200  F# makes very simple.

Thanks

SreenivasaRagvan.

No comments: