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.
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.
mko repl
> 2 + 2
4
> fn double(x) { return x * 2; }
> double(21)
42
> exitClean 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.
# 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 --checkYour comments stay in the file. The formatter only makes the layout easier to read.
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.
mko test # runs ./tests/*.mko
mko test some/dir # or a custom directory