Small hands-on exercises to practice the basics of the Mojo programming language. Ideal for developers who are new to Mojo but know basics of Python.
Inspired by Rustlings project that has a similar approach to teach Rust.
- Install Mojo
- Clone this repository or better yet, fork it and clone your fork.
- Install necessary Python packages to run the exercises:
Feel free to use virtualenv or any other tool to manage your Python packages.
pip3 install -r requirements.txt
- Run the exercises:
python mojo_gym.py
- Follow the instructions and have fun!
This is an optional reading if you are interested in how mojo-gym structures the learning material.
Because Mojo is very similar to Python, we omit some of the basic concepts that are shared between the two languages, for example, control flow statements. We focus on the concepts that are unique to Mojo.
We start with variables, functions, and value ownership (+ mutability). This is a bit different from what Mojo documentation has. The reason is we try to avoid introducing new concepts and we also want to build new knowledlge on top of the previous exercises.
When you are familiar with the previous topics, we move to structs, value lifecycle, metaprogramming and traits.
We finish the learning with exercises on Python integration and modules/packages in Mojo.
Hopefully, you will find this project useful and fun!