Hare by Example: Hello World

Our first program will print the classic "hello world" message. Here's the full source code.

// We import the fmt module in order to print text.
use fmt;

// The main entrypoint to all Hare programs must follow this signature.
export fn main() void = {
	fmt::println("Hello, world!")!;
};
# We can run the program directly and Hare will compile and run the
# program in one step.
$ hare run hello-world.ha
4/4 tasks completed (100%)
Hello, world!

# We can also compile it separately into a binary executable file.
$ hare build hello-world.ha
$ ls
hello-world    hello-world.ha

# We can now run the compiled binary executable file.
$ ./hello-world
Hello, world!