Builtins
This topic is meant to document builtins in Pile
What is a builtin?
A builtin is an operation that is built into Pile's interpreter. Builtins can have various use cases and help the developer to create programs with basic features.
Builtins
Builtin | Description |
print | Prints the last element on the stack to stdout. |
println | Prints the last element on the stack to stdout with a newline character at the end. |
eprint | Prints the last element on the stack to stderr. |
eprintln | Prints the last element on the stack to stderr with a newline character at the end. |
input | Reads input from stdin until EOF and pushes the input on top of the stack. |
inputln | Reads only a line from stdin and pushes the input on top of the stack. |
tostring | Converts the last element on the stack to a string . |
tofloat | Converts the last element on the stack to a float . If the conversion fails, it pushes a nil value instead. |
toint | Converts the last element on the stack to a int . If the conversion fails, it pushes a nil value instead. |
tobool | Converts the last element on the stack to a bool . If the conversion fails, it pushes a nil value instead. |
exit | Halts the execution of the program and exits with the exit code at the top of the stack. |