Global functions

Base integrated functions (built-ins) available anywhere in your code.

Output and Input#

FunctionUse
printDisplays one or more values in console
inputReads text entered by the user
name = input("Enter your name: ")

print "Hello " name "!"
Quick reading

To request data with a personalized message, you can also use the <- operator. Review the Reading section.

Type Conversions#

These functions allow transforming a value from one type to another explicitly.

FunctionWhat it does
int(v)Converts the value to a whole number
float(v)Converts the value to a decimal number
number(v)Converts to whole or decimal depending on its content
bigint(v)Converts to a large whole number
bool(v)Converts to boolean (true / false)
str(v)Converts to text string
print int("42") + 8      # 50
print str(10) . " years"  # "10 years"
print bool(0)            # false
The as operator

As an alternative to these functions, the as operator is often more readable in certain contexts.

print "42" as int + 8         # 50
print 10 as str . " years"     # "10 years"
print "" as bool              # false

Extra utilities#

FunctionDescription
panic(msg, help, info)Abruptly stops execution and displays an error message
id(val)Returns a unique number that represents the memory address of a value
# Get the memory address of a value
text = "hello"
print "ID: " id(text)

# Error handling
age = -5
if age < 0
    panic "Invalid age"
        , "Make sure the value is a positive number"
        , "Age cannot be negative"
Type inspection

For type inspection and verification, use the static class Type. Review the Type documentation for more details.

Mathematical functions

For mathematical operations, use the static class Math. Review the Math documentation for more details.