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 want | Crash BASIC | BASIC | Python | JavaScript | Lua |
|---|---|---|---|---|---|
| A comment | // note | ' note | # note | // note | -- note |
| Nothing | NULL | — | None | null | nil |
| Equal, not equal | = <> | = <> | == != | === !== | == ~= |
| And, or, not | AND OR NOT | the same | and or not | && || ! | and or not |
| Whole division | 7 \ 2 | 7 \ 2 | 7 // 2 | Math.trunc(7 / 2) | 7 // 2 |
| Remainder | 7 MOD 2 | 7 MOD 2 | 7 % 2 | 7 % 2 | 7 % 2 |
| Power | 2 ^ 10 | 2 ^ 10 | 2 ** 10 | 2 ** 10 | 2 ^ 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 item | list(0) | a(0) | list[0] | list[0] | list[1] |
| A piece | list(1 ... 3) | — | list[1:4] | list.slice(1, 4) | {table.unpack(list, 2, 4)} |
| A piece of text | s(0 ... 2) | LEFT$(s, 3) | s[0:3] | s.slice(0, 3) | s:sub(1, 3) |
| Matrix product | a @* b | — | a @ b (NumPy) | a library | a library |
| How many | LEN(list) | UBOUND(a) | len(list) | list.length | #list |
| Add to the end | PUSH list, x | — | list.append(x) | list.push(x) | table.insert(list, x) |
| A map | {hp: 1} | — | {"hp": 1} | {hp: 1} | {hp = 1} |
| Read a key | m.hp m(key) | — | m["hp"] | m.hp m[key] | m.hp m[key] |
| Else-if | ELSE IF | ELSEIF | elif | else if | elseif |
| Choose by value | SELECT CASE | SELECT CASE | match | switch | — |
| Count | FOR i = 1 ... 5 | FOR i = 1 TO 5 | for i in range(1, 6) | for (let i = 1; i <= 5; i++) | for i = 1, 5 do |
| Each item | FOR x = list | FOR EACH x IN a | for x in list | for (const x of list) | for _, x in ipairs(list) do |
| Leave a loop | BREAK | EXIT FOR | break | break | break |
| A function | FUNCTION f(a) | SUB / FUNCTION | def f(a): | function f(a) {} | function f(a) end |
| Its own variable | LOCAL x = 1 | LOCAL x | (the default) | let x = 1 | local x = 1 |
| The rest of the arguments | rest... | — | *rest | ...rest | ... |
| A small function | n => n * 2 | — | lambda n: n * 2 | n => n * 2 | function(n) return n * 2 end |
| A record | TYPE | TYPE | class | class | a table |
| Itself, in a method | SELF | — | self | this | self |
| A set of named numbers | ENUM | ENUM | Enum | a frozen object | a table |
| A constant | CONST x = 1 | CONST x = 1 | X = 1 | const x = 1 | local x <const> = 1 |
| Another file | IMPORT "lib" | INCLUDE | import lib | import "./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 background | ASYNC f() | — | a thread | a promise | a coroutine |
| Wait for it | RESOLVE(future) | — | .result() | await | coroutine.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.