0Pricing
Mojo Academy · Lesson

Exploring in the Mojo REPL

Try expressions interactively.

Exploring in the Mojo REPL is a free Mojo Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Mojo Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

A Playground for Code

Sometimes you just want to try a line quickly. The REPL lets you type Mojo and see results instantly, no file needed. 🎮

What REPL Stands For

REPL means Read, Evaluate, Print, Loop. It reads your line, runs it, prints the result, then waits for the next line.

Start the REPL

Open it by typing mojo with no file name in your terminal. A prompt appears, ready for you to enter expressions.

mojo

Type an Expression

At the prompt, type something simple like a sum. The REPL evaluates it and shows the answer right away.

1 + 2

Print in the REPL

You can call print just like in a file. The text shows up immediately under the line you typed.

print("Hello from the REPL")

Make a Variable

Declare a value with var and the REPL remembers it. You can reuse that variable in your next lines.

var x = 10

State Sticks Around

Each line builds on the last, so variables you defined stay available until you quit. This makes quick experiments easy.

var y = x * 2

Test Ideas Fast

The REPL is perfect for checking how a function or expression behaves before you commit it to a real file.

No main Required

Unlike a file, the REPL needs no main function. You type statements directly and they run as soon as you enter them.

Leaving the REPL

When you are done, type :quit or press Ctrl-D to exit back to your normal terminal. Your session variables are then cleared.

:quit

REPL vs Files

Use the REPL for quick tries and learning; use files for real programs you save, run again, and share. Both have their place.

Quick Check

You want to test a one-line expression without creating a file. What tool fits best?

Recap

The REPL runs Mojo line by line, keeps your variables during the session, needs no main, and is ideal for fast experiments. 🎯

Frequently asked questions

Is the “Exploring in the Mojo REPL” lesson free?

Yes — the full text of “Exploring in the Mojo REPL” is free to read here on the web, and the Mojo Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Mojo Academy course, upgrade to CoddyKit PRO.

What will I learn in “Exploring in the Mojo REPL”?

Try expressions interactively. You practise Mojo Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Mojo Academy?

No prior experience is required. Mojo Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Exploring in the Mojo REPL” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Mojo Academy lesson?

Yes. Every Mojo Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

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