Skip to main content

Reference

A sheet to look things up at a glance. Each section points to the page that covers it in full.

Reserved words​

They can't be the names of variables, functions, classes or parameters:

andbreakcasecatchclassconst
continuedefdefaultdivdoelfor
elseelsifendenumexitfalse
fnforforeachfuncifimport
inmodnilnotoffon
operatororprivaterefrepeatreturn
structsuperswitchthenthistrue
trytypeuntilusevarwhile

do, repeat and ref are reserved, but in 0.9.7 they aren't used for anything: while and until don't take do, and ref gives an error when compiling.

WordsWhat forWhere
var, const, enumVariables, constants and enumerationsVariables and constants
if, then, elsif, else, switch, case, defaultChoosing what runsControl structures
for, elfor, foreach, in, while, until, break, continueLoopsControl structures
endClosing a blockBasic syntax
func, return, fnFunctions and lambdasFunctions
class, def, this, super, private, operatorClasses and objectsClasses and objects
structData structuresStructs
try, catch, exitErrors and leaving the programErrors and exceptions
use, importModules and other filesPrograms in several files
and, or, not, div, modOperatorsOperators
true, false, on, off, nilValuesData types
typeThe type of a valuetype

Operators​

OperatorsWhat they do
+, -, *, /Addition, subtraction, multiplication and division. / always gives a decimal: 5 / 2 is 2.5.
div, mod, %Integer division and remainder: 5 div 2 is 2, and 5 mod 2 and 5 % 2 are 1.
++, --Add or subtract one to a variable: x++.
==, !=, <, <=, >, >=Compare two values.
and, or, not, !Logical. ! is the same as not.
&, |, ^, ~, <<, >>Bitwise. With two booleans, ^ is the exclusive or: true ^ false is true.
? :Conditional: a > b ? a : b.
=, +=, -=, *=, /=, %=Assignment.

In JARU, and and or have the same precedence, and not is worked out before comparisons: use parentheses when you mix them. The order of all of them is in Operator precedence, and each one, with examples, in Operators.

Types​

TypeWritten astype() gives
Booleantrue, false, on, offtBool
No valueniltNil
Integer, 32-bit signed42, -7, 0x1FtInteger
Decimal, 64-bit3.14, .5, 1e3tFloat
String"hello", 'hello'tString
List[1, 2, 3]tList
Map{"x": 1, "y": 2}tMap
Array{1, 2, 3}tArray
Function and lambdafunc, fntFunction
Class and instanceclass, Player()tClass, tInstance

The details are in Data types. String methods are in Strings, and those of lists, maps and arrays in Lists, maps and arrays.

Standard library​

Functions that don't need use:

ForFunctions
The consoleprint, println, readLine, cls, ink, paper
Timepause, clock, time
Converting and knowing the typechr, int, float, type
Random numbersrandomize, random
Arithmeticabs, round, sqrt, vlenght
How long something islen
Colorsrgb
The system and memorymemUse, memFree, platform, vmerror
Base64encode64, decode64

Constants​

The compiler knows them without use:

ConstantsWhat for
HW_ESP32, HW_ESP32S3, HW_WIN32, HW_WEB, HW_ESP32P4, HW_ESP32S31What platform() returns
tBool, tInteger, tFloat, tString, tList, tMap…What type() returns
ERR_UNKNOWN … ERR_TIME_OUTThe errors: see Errors and exceptions
LOW, HIGHThe levels of a pin: see GPIO
PI, SQRT2π and √2: see Math

The full list, with their values, is in Constants.

Modules​

They're brought in with use, as in use Display. How they're used, in Modules.

ModuleWhat for
DisplayOpening the screen or the window, its size and its background, and the game's pace
DrawDrawing points, lines, rectangles, circles, text, images and tilemaps
BitmapLoading BMP images and working with them
SpriteSprites with animation, collisions and physics
GridMap2D grids: tilemaps, collisions with the map and pathfinding
SceneThe scene: its sprites, the camera, the physics and the map
SoundSynthesised sounds, PCM samples and music
InputThe keyboard, the buttons and the gamepad, as game actions
GPIOInput and output pins, PWM and interrupts
I2CSensors and other devices connected over I2C
LEDStrips and matrices of WS2812 colour LEDs
PowerPutting the board to sleep to save power, and waking it up
MQTTPublishing and receiving MQTT messages
HttpHTTP requests to APIs and web services
FileFiles and folders, in the flash, on the SD card or on the PC
BytesByte blocks for binary data
JSONReading and writing JSON
TimerCalling a function after some time, once or every so often
MathMathematical functions and constants
GCThe garbage collector, which frees the memory that's no longer used

Resources​