0Pricing
Mojo Academy · Lesson

The main Entry Point

Why scripts start at the main function.

Every Program Needs a Start

When you run a Mojo file, the program needs to know where to begin. That starting point is a special function named main. 🚀

Mojo Looks for main

The toolchain searches your file for a function called main and calls it for you. You never call main yourself.

def main():
    print("Program started")

All lessons in this course

  1. Your First .mojo File
  2. The main Entry Point
  3. Running with mojo run
  4. Exploring in the Mojo REPL
← Back to Mojo Academy