Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Where you came from

That’s the language! Here’s the lot on one page, next to what you’d have written before. Keep it open while your fingers catch up.

You wantCrash BASICBASICPythonJavaScriptLua
A comment// note' note# note// note-- note
NothingNULL—Nonenullnil
Equal, not equal= <>= <>== !==== !==== ~=
And, or, notAND OR NOTthe sameand or not&& || !and or not
Whole division7 \ 27 \ 27 // 2Math.trunc(7 / 2)7 // 2
Remainder7 MOD 27 MOD 27 % 27 % 27 % 2
Power2 ^ 102 ^ 102 ** 102 ** 102 ^ 10
Join text"a" + b"a" + b$"a" + str(b)"a" + b"a" .. b
Many-line text`...`—"""..."""`...`[[...]]
A list[1, 2]DIM a(1)[1, 2][1, 2]{1, 2}
First itemlist(0)a(0)list[0]list[0]list[1]
A piecelist(1 ... 3)—list[1:4]list.slice(1, 4){table.unpack(list, 2, 4)}
A piece of texts(0 ... 2)LEFT$(s, 3)s[0:3]s.slice(0, 3)s:sub(1, 3)
Matrix producta @* b—a @ b (NumPy)a librarya library
How manyLEN(list)UBOUND(a)len(list)list.length#list
Add to the endPUSH list, x—list.append(x)list.push(x)table.insert(list, x)
A map{hp: 1}—{"hp": 1}{hp: 1}{hp = 1}
Read a keym.hp m(key)—m["hp"]m.hp m[key]m.hp m[key]
Else-ifELSE IFELSEIFelifelse ifelseif
Choose by valueSELECT CASESELECT CASEmatchswitch—
CountFOR i = 1 ... 5FOR i = 1 TO 5for i in range(1, 6)for (let i = 1; i <= 5; i++)for i = 1, 5 do
Each itemFOR x = listFOR EACH x IN afor x in listfor (const x of list)for _, x in ipairs(list) do
Leave a loopBREAKEXIT FORbreakbreakbreak
A functionFUNCTION f(a)SUB / FUNCTIONdef f(a):function f(a) {}function f(a) end
Its own variableLOCAL x = 1LOCAL x(the default)let x = 1local x = 1
The rest of the argumentsrest...—*rest...rest...
A small functionn => n * 2—lambda n: n * 2n => n * 2function(n) return n * 2 end
A recordTYPETYPEclassclassa table
Itself, in a methodSELF—selfthisself
A set of named numbersENUMENUMEnuma frozen objecta table
A constantCONST x = 1CONST x = 1X = 1const x = 1local x <const> = 1
Another fileIMPORT "lib"INCLUDEimport libimport "./lib.js"require("lib")
Free something(let go of it)ERASE a(let go of it)(let go of it)(let go of it)
Start in the backgroundASYNC f()—a threada promisea coroutine
Wait for itRESOLVE(future)—.result()awaitcoroutine.resume

Things only I have

  • ## and _ — pass a value along a chain of steps.
  • BIND — turn a function into a keyword.
  • !!, the WOMT operator — Wait! One more thing! Named options on the end of a statement.
  • BLOCKBIND, SCOPEBIND, HANDLERBIND — keywords that own a block.
  • Errors as values — declared with the message a person will read.
  • REWRITE — let a line be written another way.
  • Coordinates and vectors — (x, y) and (a) -> (b), built in.
  • Matrices — turn @* ship: a list of rows has @*, @+ and @-.

Where next

Everything here was just me, on my own. Inside a game engine I’m given a great many more words — for drawing, sound, input and the rest — every one of them made the way you’ve just learned. And now you know how to add your own.

Go and make something! I’ll be here when it goes sideways.


Crash-tan, her name and her likeness are © Crash Continuum LLC, all rights reserved. She is not covered by the license Crash BASIC is offered under.