using System;
public class HelloWorld
{
static public void Main ()
{
Console.WriteLine ("Hello World");
}
}[greg:~] cd dev/src/mono [greg:mono] gmcs Hello.cs [greg:mono] ls Hello.cs Hello.exe [greg:mono] mono hello.exe Hello World [greg:mono]
Now, how do I get F# to run? Download the zip file from the F# home page and, just as before, execute the exe file by entering the mono fsi.exe command which puts the terminal session in mono mode.
> let buf = System.Text.StringBuilder("Coding");;
val buf : System.Text.StringBuilder = Coding
> buf.Append(" F# is F#un");;
val it : System.Text.StringBuilder =
Coding F# is F#un {Capacity = 32;
Chars = ?;
Length = 17;
MaxCapacity = 2147483647;}
> buf.ToString();;
val it : string = "Coding F# is F#un"
>
In this code, the declared variable is untyped. I think Venkat Subramaniam would tell us of its similarities to VB. By the way, see Venkat's videos here.