Hello World!

A ‘Hello World!’ program in M# looks like this:

using System;

class MainClass

  public static function Main()
    Console.WriteLine('Hello World!');
  endend

The first line imports the System namespace. This will let us call methods on the Console class.

The next line declares a class type, which in this case is called MainClass. The next line declares the Mainfunction. The compiler looks for a static method named Main, and sets it as the entry point.