Documentation menu

Getting Started

Playground, Format & Tests

MAKO includes a playground, a code cleaner, and a test runner. They help you try ideas and find mistakes.

New to coding?

Copy the examples exactly first. Run them. Then change one number or word and run them again. You are not expected to memorize the command lists.

1

Try one line at a time

Run mko repl to open the playground. Type a little bit of code and see the answer immediately. Type exit when you are done.

Try this code
mko repl
> 2 + 2
4
> fn double(x) { return x * 2; }
> double(21)
42
> exit
2

Clean up your code

fmt is short for format. Formatting makes messy code neat by fixing spaces and indentation. The first command cleans the file. --check only looks and tells you whether the file is already neat.

Try this code
# fmt means "format" or "make my code neat"
mko fmt game.mko

# Check the layout, but do not change the file
mko fmt game.mko --check

Your comments stay in the file. The formatter only makes the layout easier to read.

3

Check that things still work

mko test runs every .mko file in the tests folder. A green PASS means it worked. A red FAIL shows which file needs help.

Try this code
mko test              # runs ./tests/*.mko
mko test some/dir      # or a custom directory