Numeric functions
Function | Feature | Sample | 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 exponent | 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 | Feature | Sample | 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 all cased letters in a string to lowercase | lower("HELLO") | "hello" |
upper | Converts all cased letters in a string to uppercase | upper("hello") | "HELLO" |
join | Concatenates elements of a string list with the given 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?