Skip to content

Basic Functions and Operators

Before going in note that any time VARNAME or FUNCNAME is written, it means a variable or function in the form Collection@Variableor a literal.

call

Syntax:

call FUNCNAME
Calls the function named FUNCNAME.

if

Syntax:

if VARNAME1 == VARNAME2 FUNCNAME
Uses the operator in the middle to compare VARNAME1 and VARNAME2, and if the result is true, calls FUNCNAME. Operators include: ==, !=, <, >, <=, >=.

print

Syntax:

print(VARNAME)

Prints the value of VARNAME to the console.

input

Syntax:

VARNAME1 = input(VARNAME2)

Gets user input from the console with prompt VARNAME2 and stores the result in VARNAME1.

timeit

Syntax:

timeit FUNCNAME
Measures the time taken to execute FUNCNAME and prints the result to the console.

loop

Syntax:

loop VARNAME1 VARNAME2 FUNCNAME

Loops from VARNAME1 to VARNAME2 (end value exclusive) and calls FUNCNAME in each iteration.

until_break

Syntax:

until_break FUNCNAME

Loops until breaking and calls FUNCNAME in each iteration.

break

Syntax:

break

Exits the current loop immediately.

Variable Cloning

Syntax:

VARNAME1 <- VARNAME2

Clones the value of VARNAME2 into VARNAME1. This used when needing to temporarily store a value before modifying it, such as with a counter.

exec

Syntax:

VARNAME1 = exec(VARNAME2)

Executes the commandline command in the string VARNAME2, outputs result to VARNAME1

Types

Syntax:

1
2
3
4
5
6
7
NUM num: 1.0
STR str: "Hello, World!"
BOOL bool: true
ARR arr: [1, 2, 3]
TUP tuple: ("HELLO WORLD", 123)
FN l: |print(?@str)|
(_) unknown: ""

All variables are typed, if the type (_) is used the type is inferred, otherwise its explicit.

wait

Syntax:

wait(VARNAME)

Pauses execution for the number of seconds specified in VARNAME.

Legacy Shorthand Operator

Syntax:

?@VARNAME = 1+1

The shorthand ? is used for the current collection instead of writing out the full name. This has been replaced by just typing the variable name without collection name or @, this feature is depreceated but has been left in for backwards compatibility.

free

Syntax:

free(VARNAME)

Frees the variable VARNAME from memory, allowing it to be reused. Useful for memory management.

exit

Syntax:

exit

Exits the program forcefully

fwrite

Syntax:

fwrite(VARNAME1, VARNAME2)

Writes the contents of the string VARNAME2 to the file at path VARNAME1, replacing the files contents and creating the file if it does not exist

fread

Syntax:

VARNAME1 = fread(VARNAME2)

Reads the contents of the file at path VARNAME2, returning the result to VARNAME1

t_spawn

Syntax:

VARNAME1 = t_spawn(VARNAME2)

Spawns the function VARNAME2 in a thread, returning the thread ID to VARNAME1

t_join

Syntax:

VARNAME1 = t_join(VARNAME2)

Waits for the thread with id VARNAME2 to end, returning a bool for success

parse

Syntax:

VARNAME1 = parse(VARNAME2)

Parses the string representation of a variable of a different type to that type. For example "100" becomes the number 100.