Menu

bubblecode supports standard arithmetic and a library of built-in math functions.

Arithmetic operators

OperatorMeaningExample
+Addition2 + 3
-Subtraction10 - 4
*Multiplication6 * 7
/Division20 / 4
modModulo17 mod 5
^Exponent2 ^ 10
example.bubble

Parentheses control evaluation order, just like in normal math.

Built-in math functions

FunctionDescription
abs(n)Absolute value
round(n)Round to nearest integer
floor(n)Round down
ceil(n)Round up
sqrt(n)Square root
min(...)Smallest of the arguments
max(...)Largest of the arguments
example.bubble

Random numbers

The random(n) function returns a random integer between 1 and n (inclusive).

example.bubble