Slide 1 of 74

Hello, World

proc main(): void {
	echo "it works"
}

Every Hive program starts at proc main(): void, in the file handed to hive run or hive build. main takes nothing and answers with nothing, and any other signature is a compile error: the command line arrives through hive.term.args() and an exit status leaves through hive.term.exit(code), both of them met later on. A file with no main at all still compiles — it is a library, or a file of tests.

echo prints one value and a newline, turning whatever it is given into text the way the slide on echo describes. Inside a double-quoted string, {…} puts a value in — echo "{a} and {b}" prints both — and the slide on strings has the rest.

← PrevNext →