Skip to content

Latest commit

 

History

History

mojo

Mojo code examples

A collection of sample programs written in the Mojo programming language.

Getting Started

The easiest way to get started with Mojo is to install the Magic package and virtual environment manager. By following the instructions in Get started with Magic, you can quickly install Magic and use it to create a virtual environment for Mojo programming. Alternatively, you can follow the instructions for how to Add MAX/Mojo to a conda project.

After you have set up a Mojo programming environment, you can then use git to clone this repository of Mojo samples using the command below:

git clone https://github.com/modular/max.git

Running

If you're using magic, navigate into the examples directory and use magic run to invoke mojo and run the basic example programs. For example:

magic run mojo matmul.mojo

You'll also find several complete Mojo projects as subdirectories of the examples directory.

License

The Mojo examples in this repository are licensed under the Apache License v2.0 with LLVM Exceptions (see the LLVM License).

Contributing

As a contributor, your efforts and expertise are invaluable in driving the evolution of the Mojo programming language. The Mojo contributor guide provides all the information necessary to make meaningful contributions—from understanding the submission process to adhering to best practices: