Builtin Functions

exit(INTEGER)

Terminates the program with the given exit code.

🚀 > exit(1)
exit status 1

raise(INTEGER, STRING)

Terminates the program with the given exit code and prints the error message.

🚀 > raise(1, "broken")
🔥 RocketLang raised an error: "broken"
exit status 1

puts(STRING|ARRAY|HASH|BOOLEAN|INTEGER|NULL|FILE)

Prints the string representation of the given object to STDOUT.

🚀 > puts("test")
"test"

🚀 > puts([1,2,3])
[1, 2, 3]

🚀 > puts(["test",true,3])
["test", true, 3]

open(STRING, STRING)

Returns FILE

Opens a file pointer to the file at the path of argument one with the mode of (optional) argument two.

🚀 > open("main.go", "ro")
=> <file:main.go>

Edit this page on GitHub