Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hello World

We can now see the famous Hello World program in src/Main.flix file:

def main(): Unit \ IO = 
    println("Hello World!")

That’s it!

You will immediately notice a few things are different from other programming languages:

  • The main function has no formal parameters, in particular it does not take an arguments array. Instead the command line arguments are available through the Env effect (see The Main Function).
  • The return type of the main function is Unit.
  • The main function has the IO effect since it prints to the terminal.