Standard Docs
Documentation For Every Feature
serve
The serve built-in is used for printing values to the terminal.
obj x = 10;
serve(x); // output: 10
process
The process built-in is used for getting standard input (stdin) from the terminal.
obj input = process("Enter some text: ");
serve("You typed: " + tostring(input));
type
The type built-in is used for checking an object's type.
obj my_object = 10;
serve(type(my_object)); // output: number
isnumber
Returns true if object is a number.
obj x = 10;
serve(isnumber(x)); // true
isdecimal
Returns true if number has a decimal.
serve(isdecimal(1.1)); // true
isstring
Returns true if object is a string.
obj x = "a string";
serve(isstring(x)); // true
islist
Returns true if object is a list.
obj x = [1, 2, 3, 4];
serve(islist(x)); // true
isfunction
Returns true if object is a function.
serve(isfunction(type)); // true
isbuiltin
Returns true if object is a built-in function.
serve(isbuiltin(type)); // true
tostring
Convert object to string.
obj x = 10;
serve("x is equal to: " + tostring(x)); // output: x is equal to: 10
tonumber
Convert string to number.
obj x = "2.14";
obj x = tonumber(x);
serve(x + 1); // output: 3.14
push
Add a value to a list.
obj x = [1, 2, 3];
obj x = push(x, 4);
serve(x); // output: [1, 2, 3, 4]
append
Combine two lists.
obj x = [1, 2, 3];
obj y = [4, 5, 6];
obj new_list = append(x, y);
serve(new_list); // output: [1, 2, 3, 4, 5, 6]
remove
Remove a value at the specified index.
obj x = [1, 2, 3];
obj x = remove(x, 0);
serve(x); // output: [2, 3]
retrieve
Retrieve a value from a list.
obj x = [1, 2, 3];
obj value_in_list = retrieve(x, 0);
serve(value_in_list); // output: 1
reverse
Reverse a list.
obj x = [1, 2, 3];
obj reversed_x = reverse(x);
serve(reversed_x); // output: [3, 2, 1]
join
Join two strings.
obj x = "Hello, ";
obj y = "world!";
serve(join(x, y)); // output: Hello, world!
startswith
Check if string starts with chars.
obj x = "12345";
serve(startswith(x, "1")); // true!
endswith
Check if string ends with chars.
obj x = "12345";
serve(endswith(x, "5")); // true!
charat
Get character at index in string.
obj x = "12345";
serve(charat(x, 0)); // output: 1
clear
Clear a list or string and return empty.
# list
obj x = [1, 2, 3, 4];
obj x = clear(x);
serve(x); // output: []
# string
obj x = "This is a string";
obj x = clear(x);
serve(x); // output:
length
Get the length of a string or list.
obj x = "this string is long";
obj y = [1, 2, 3];
serve(length(x)); // output: 19
serve(length(y)); // output: 3
sweep
Retrieve contents of a file.
obj contents = sweep("example.txt");
serve(contents); // output: <contents of example.txt>
stash
Write a string to a file.
stash("example.txt", "These are some contents in a file");
serve(sweep("example.txt")); // output: These are some contents in a file
uhoh
Throw an error with message.
if 1 == 1 {
skip;
} otherwise {
uhoh("math is broken!!");
}
number
Primitive data type that represents any numerical value.
obj x = 10; // whole
obj y = 10.0; // decimal
Each number is stored as a 64 bit floating point, meaning there is no specific integer or float type.
string
Represents UTF-8 encoded text.
obj string = "This is a string!";
obj emoji = "⚠️🤔🏃♂️➡️🎯"; //// utf-8 encoded, meaning we can add emojis and any supported chars!
// strings can also be wrapped over multiple lines
obj multiline = "
This
is
multiple
lines
of
text
";
// to add quotes inside a string use \"
obj string_with_quotes = "What's up \"bro\"";
list
Infinitely growable collection of values.
obj x = [1, 2, 3];
serve(x);