Core Language
Variables & Types
A variable is a named box that remembers something. Put a value in the box with =. MAKO can remember numbers, words, yes/no values, nothing, lists, dictionaries, and functions.
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.
Named boxes
The name goes on the left. The value goes on the right. Text uses quote marks. true and false mean yes and no. none means there is no value.
count = 10;
name = "Robin";
alive = true;
nothing = none;
items = [1, "two", 3.5];A box that cannot change
const creates an immutable binding — top-level or inside any block. Reassigning one is a runtime error with a clear message.
const MAX_LIVES = 3;
const GRAVITY = 9.81;
GRAVITY = 10; // error: cannot reassign const 'GRAVITY'Compound assignment
These shortcuts change a number without writing its name twice.
x += 5;
x -= 2;
x *= 3;
x /= 4;
y = -x;What counts as yes?
An if asks a yes-or-no question. false, 0, empty text, empty lists, empty dictionaries, and none count as no. Other values count as yes.
if 0 { print "never"; }
if "" { print "never"; }
if [] { print "never"; }
if -1 { print "yes, truthy"; }Ask what kind of value it is
type(value) tells you the value's kind. This is useful when you are confused about what a variable holds.
type(42) // "number"
type("hi") // "string"
type(true) // "bool"
type(none) // "none"
type([1,2]) // "list"
type({"a":1}) // "dict"
type(fn(x)=>x) // "fn"