Hello, Blorp
Start with the program entry point, a line of output, and the run command.
Main
A runnable file defines main as the entry point. args is argv-style: args[0] is the program entry and user arguments follow.
func main(args: List[String]) -> Void:
print("Hello, world!")
Printing
print writes a trailing newline. puts writes without adding one, and print_error writes to stderr.
print("one line")
puts("prompt> ")
print_error("warning")
Exit Codes
A main returning Void exits successfully and returns an exit code of 0. A main returning Int uses the final Int expression as the process exit code.
func main(args: List[String]) -> Int:
print("ok")
0
Example
hello.brp
func main(args: List[String]) -> Void:
print("Hello, world!") -- prints: Hello, world!
Exit-Code Version
hello-exit.brp
func main(args: List[String]) -> Int:
print("Hello, world!") -- prints: Hello, world!
0
Try it
terminal
blorp run hello.brp