Helios language/

print, error, assert

There are three builtin void functions. These can be used to define higher level user-defined void functions.

Void functions can't be used in assignments.

print

For debugging purposes, Helios has a special print expression. print(...) takes a String argument:

func main() -> Bool {
	print("Hello world");
	true
}

Note: print expressions are useful when debugging scripts. They are however eliminated by the compiler when compiling scripts optimized for production.

error

Helios has a special error builtin, which can be used to throw errors inside branches of if-else expressions, and cases of switch expressions. At least one branch or case must be non-error-throwing for the if-else or switch expression to return a non-void value.

if (cond) {
    true
} else {
    error("my error message")
}
x.switch{
    Buy => true,
    Sell => error("my error message")
}

assert

The builtin assert function throws an error if a given expression evaluates to false.

assert(condition, "should be true"); ...