Hello World

Every Lux program starts with a main function. This function is the entry point - where execution begins.

Edit the code on the right and click Run to see the output.

Key Points

  • fn declares a function
  • Unit is the return type (like void)
  • with {Console} declares this function uses console I/O
  • Console.print outputs text
  • run ... with {} executes effectful code

Notice the with {Console} in the function signature. This is what makes Lux special - the type tells you this function interacts with the console. No hidden side effects!

Try changing the message and running again.

main.lux
Output
// Click "Run" to execute