Numeric Functions
Function Name |
Feature |
Example |
Result |
abs |
Returns an absolute value |
abs(-1024) |
1024 |
ceil |
Rounds up |
ceil(5.1) |
6 |
floor |
Rounds down |
floor(4.9) |
4 |
log |
Calculates a logarithm |
log(16, 2) |
4 |
pow |
Calculates an exponential power |
pow(3,2) |
9 |
max |
Returns the maximum value |
max(12,54,3) |
54 |
min |
Returns the minimum value |
min(12, 54, 3) |
3 |
String Functions
Function Name |
Feature |
Example |
Result |
chomp |
Removes newline characters at the end of a string |
chomp("hello\n") |
"hello" |
format |
Formats a string |
format("Hello, %s!", "Ander") |
"Hello, Ander!" |
lower |
Converts a string to lowercase letters |
lower("HELLO") |
"hello" |
upper |
Converts a string to uppercase letters |
upper("hello") |
"HELLO" |
join |
Concatenates a string list by using a specified delimiter |
join(", ", ["foo", "bar", "baz"]) |
"foo, bar, baz" |
replace |
Replaces specified characters in a string |
replace("1 + 2 + 3", "+", "-") |
"1 - 2 - 3" |
For more information on functions, see Built-in Functions.
Was this page helpful?