31 people like it.

Hello world (.NET)

Classical "Hello world" example that prints a message to the console output. This version uses .NET Console.WriteLine method to do the printing.

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
// Open namespace with the 'Console' class
open System

// Declare a local value (inferred type is string)
let world = "world"

// Using '{0}' to print value of the first parameter
Console.WriteLine("Hello {0}!", world)
namespace System
val world : string

Full name: Script.world
type Console =
  static member BackgroundColor : ConsoleColor with get, set
  static member Beep : unit -> unit + 1 overload
  static member BufferHeight : int with get, set
  static member BufferWidth : int with get, set
  static member CapsLock : bool
  static member Clear : unit -> unit
  static member CursorLeft : int with get, set
  static member CursorSize : int with get, set
  static member CursorTop : int with get, set
  static member CursorVisible : bool with get, set
  ...

Full name: System.Console
Console.WriteLine() : unit
   (+0 other overloads)
Console.WriteLine(value: string) : unit
   (+0 other overloads)
Console.WriteLine(value: obj) : unit
   (+0 other overloads)
Console.WriteLine(value: uint64) : unit
   (+0 other overloads)
Console.WriteLine(value: int64) : unit
   (+0 other overloads)
Console.WriteLine(value: uint32) : unit
   (+0 other overloads)
Console.WriteLine(value: int) : unit
   (+0 other overloads)
Console.WriteLine(value: float32) : unit
   (+0 other overloads)
Console.WriteLine(value: float) : unit
   (+0 other overloads)
Console.WriteLine(value: decimal) : unit
   (+0 other overloads)

More information

Link:http://fssnip.net/r
Posted:14 years ago
Author:Tomas Petricek
Tags: console , writeline , hello world , let , namespace