Mojo Next Steps
You’ve made it through the tutorial. You can write Mojo programs with structs and traits, handle errors, think about ownership, use compile-time parameters, speed code up with SIMD and call Python. That’s a solid base. This page gives you a map of what you’ve covered, and then the best places to go next: the official docs, GPU programming, real projects, the community and contributing to Mojo itself.
What you’ve learned
Section titled “What you’ve learned”Here’s the whole tutorial on one map. Each row links to the first page of its section, so you can jump back whenever you need a refresher.
| Section | What you can do now | Start here |
|---|---|---|
| Getting Started | Install Mojo with uv or pixi, run and build programs, print output | Mojo Get Started |
| Basics | Use variables, numbers, strings and conversions, and avoid overflow surprises | Mojo Variables |
| Control Flow | Branch with if and match, loop with for and while |
Mojo If…Else |
| Functions | Write typed functions with defaults, *args, closures and lambdas |
Mojo Functions |
| Collections | Work with List, Dict, Set, tuples, Optional, Array and Span |
Mojo Lists |
| Structs & Traits | Build your own types, overload operators, print them, share behavior with traits | Mojo Structs |
| Ownership & Memory | Know when values are copied, moved, borrowed or destroyed, and use pointers carefully | Mojo Value Semantics |
| Error Handling | Raise and catch errors, define your own error types, add asserts | Mojo Errors |
| Compile Time & Generics | Write generic code with parameters, traits and where clauses |
Mojo Compile-Time Code |
| Performance | Use SIMD, vectorize, parallelize and measure honestly |
Mojo SIMD |
| Python Interop | Call Python libraries like NumPy, and call Mojo from Python | Mojo and Python |
| GPU Programming | Write and launch kernels on a supported GPU | Mojo GPU Basics |
| C Interop | Call C libraries and export Mojo functions to C | Mojo Calling C |
| Building Real Programs | Split code into modules, read files, arguments and input, package and build | Mojo Modules & Packages |
| Testing & Debugging | Write tests with std.testing, debug, use -D feature toggles |
Mojo Testing |
| Compiler Errors | Read the most common error messages and fix them | Mojo Errors Explained |
| Projects | Put it all together in seven small projects | Project: Guessing Game |
| Practice | Test yourself with graded exercises and interview questions | Mojo Exercises |
If one row feels shaky, that’s where to spend an hour before you move on.
Read the official manual
Section titled “Read the official manual”The Mojo Manual is the official guide, written by the people who build the language. Now that you know the basics, it reads much more easily than on day one, and it goes deeper on the hard parts: origins and lifetimes, the value lifecycle, metaprogramming and pointers.
Three official pages are worth a look straight away:
- The Game of Life tutorial builds a complete small program step by step. It’s good practice to follow it and compare with how you’d have done it.
- The standard library reference lists every type and function. When you wonder “is there a method for that?”, look here first.
- The Mojo tips for Python developers page, if you came from Python. It explains why the habits that tripped you up are different.
Learn GPU programming
Section titled “Learn GPU programming”GPUs are a big reason Mojo exists. If you haven’t done the GPU section of this tutorial yet, start with Mojo GPU Basics. After that, Modular’s Mojo GPU Puzzles is the natural next step: a free online book of small GPU exercises that start from “add 10 to every element” and build up to topics like tiled processing, warp-level programming and profiling.
Be realistic about hardware. You need a supported GPU to run kernels, and some puzzles (like the debugging ones) only work on NVIDIA GPUs. The puzzles’ first pages list what each part needs. If you don’t have a GPU, you can still read through them and learn the ideas.
Build things
Section titled “Build things”Reading only takes you so far. The fastest way to get comfortable is to build small programs you actually want. Some ideas, with the lessons they’ll make you use:
| Project | You’ll practise |
|---|---|
| A command-line unit converter (km to miles, °C to °F) | arguments, type conversion, errors |
| A log file analyser that counts errors per hour | file I/O, dictionaries, strings in depth |
| A small matrix or image library with your own struct | structs, operator overloading, SIMD |
| Speed up the slowest function in a Python script you already have | Calling Mojo from Python, benchmarking |
| A text adventure or quiz game | reading input, match, lists |
A tiny library with docs and tests, shared as a .mojoc |
testing, documentation, packaging |
Start small, get it working, then improve it. Here’s a starter for a stats tool. It reads numbers from a line of text and prints a summary:
@fieldwise_initstruct Stats(Writable): var count: Int var low: Float64 var high: Float64 var mean: Float64
def summarize(values: List[Float64]) raises -> Stats: if len(values) == 0: raise Error("no values") var low = values[0] var high = values[0] var total = 0.0 for v in values: low = min(low, v) high = max(high, v) total += v return Stats(len(values), low, high, total / Float64(len(values)))
def main() raises: var line = "12.5, 9.0, 14.25, 11.0" var values: List[Float64] = [] for part in line.split(","): values.append(Float64(part.strip())) print(summarize(values))Output:
Stats(count=4, low=9.0, high=14.25, mean=11.6875)Ideas to grow it: read the numbers from a file or from the command line, add the median (you’ll need sort), and write tests for summarize, including the empty case.
Read real Mojo code
Section titled “Read real Mojo code”Reading good code teaches you idioms that no tutorial covers. Two places to start:
- The standard library source. It lives in the modular/modular repository on GitHub, under
Mojo/stdlib. Pick a type you’ve used, likeListorOptional, and read how it’s built. You’ll recognise traits, parameters,whereclauses and lifecycle methods from this tutorial. - Community packages. The Mojo packages page lists libraries from the community, shared as conda packages. Pick one close to your interests and read its source.
Join the community
Section titled “Join the community”You don’t have to learn alone. Modular runs two places to talk:
- The Modular forum for questions, longer discussions and official announcements (roadmap updates are posted there).
- The Modular Discord for quick chat and help.
Found a bug in Mojo? Search the GitHub issues first, and open a new one with a small program that shows the problem if nobody has reported it. The compiler errors pages on this site show you what a small, clear example looks like.
Contribute to Mojo
Section titled “Contribute to Mojo”Mojo is open source, and the standard library has taken outside contributions since 2024. Modular is careful about what it accepts, though. The official contribution areas page is clear about it. At the time of writing:
- Standard library: bug fixes with a test that shows the bug, performance improvements with benchmarks, documentation improvements, better test coverage and security fixes. Not accepted, among others: broad formatting or refactoring changes, new dependencies, breaking changes, or a whole new module without going through the proposal process.
- Compiler: bug fixes (wrong diagnostics, crashes, miscompiles) and refactors that don’t change the language.
A good path for a first contribution:
- Read the contributor guide and the issue and PR etiquette it links to.
- Look for issues labelled good first issue in the GitHub repository.
- For anything bigger than a typo, the guide asks you to discuss it on an issue before you open a pull request. Keep the pull request small.
- Documentation fixes are a friendly first step: if a docstring in the standard library is unclear or wrong, fixing it is real help. Mojo Documentation showed you the docstring format they use.
Keep up with changes
Section titled “Keep up with changes”Mojo will keep changing. Two pages on this site help: Mojo Roadmap sums up what Modular is planning, and Mojo Upgrading Between Versions shows how to move your code to a new release. Before each upgrade, read the official release notes.
Practice
Section titled “Practice”1. Grow the stats tool
Section titled “1. Grow the stats tool”Extend the starter above so Stats also has a median. For the values 12.5, 9.0, 14.25, 11.0, the median is the average of the two middle values after sorting.
Hint: copy the list with .copy(), call sort() on the copy, and handle odd and even lengths.
Show solution
@fieldwise_initstruct Stats(Writable): var count: Int var low: Float64 var high: Float64 var mean: Float64 var median: Float64
def median(values: List[Float64]) -> Float64: var sorted = values.copy() sort(sorted) var n = len(sorted) if n % 2 == 1: return sorted[n // 2] return (sorted[n // 2 - 1] + sorted[n // 2]) / 2
def summarize(values: List[Float64]) raises -> Stats: if len(values) == 0: raise Error("no values") var low = values[0] var high = values[0] var total = 0.0 for v in values: low = min(low, v) high = max(high, v) total += v var mean = total / Float64(len(values)) return Stats(len(values), low, high, mean, median(values))
def main() raises: var values: List[Float64] = [12.5, 9.0, 14.25, 11.0] print(summarize(values))Output:
Stats(count=4, low=9.0, high=14.25, mean=11.6875, median=11.75)Sorted, the values are 9.0, 11.0, 12.5, 14.25. The two middle ones are 11.0 and 12.5, so the median is 11.75. Sorting a copy keeps the caller’s list in its original order.
2. Write tests like a contributor
Section titled “2. Write tests like a contributor”Standard library changes need tests. Practise the habit: write three tests for this clamp function (a value inside the range, below it and above it) and run them with TestSuite.
def clamp(x: Int, low: Int, high: Int) -> Int: if x < low: return low if x > high: return high return xHint: each test is a def test_...() raises: function that calls assert_equal. See Mojo Testing.
Show solution
from std.testing import assert_equal, TestSuite
def clamp(x: Int, low: Int, high: Int) -> Int: if x < low: return low if x > high: return high return x
def test_inside() raises: assert_equal(clamp(5, 0, 10), 5)
def test_below() raises: assert_equal(clamp(-3, 0, 10), 0)
def test_above() raises: assert_equal(clamp(42, 0, 10), 10)
def main() raises: TestSuite.discover_tests[__functions_in_module()]().run()Running it with mojo run test_clamp.mojo printed a PASS line for each test and then 3 tests run: 3 passed , 0 failed , 0 skipped. Testing the edges (just below and just above the range) is where bugs usually hide.
- You’ve covered the whole language at a beginner level: the map above links every section.
- The Mojo Manual and the standard library reference are your next reading.
- Mojo GPU Puzzles teach GPU programming step by step; you need a supported GPU to run them.
- Build small projects you care about, and read real code in the standard library and community packages.
- Ask questions on the Modular forum or Discord, and report bugs on GitHub with a small example.
- The standard library accepts bug fixes with tests, benchmarks-backed speed-ups, docs and tests; start with a good first issue.
Next up: the cheat sheet, all the syntax from this tutorial on one page.
Quick check
Section titled “Quick check”Quick check
Read more
Section titled “Read more”- Mojo Manual: the official guide to the whole language.
- Mojo GPU Puzzles: Modular’s hands-on book for learning GPU programming.
- Mojo contributor guide: how to contribute, and what to read first.
- Contribution areas: which kinds of changes each team accepts today.
- Modular forum: questions, discussions and announcements from the Mojo team and community.