Hare by Example: Constants

Constants can appear anywhere a variable can and cannot be mutated after being declared. Type declarations are also required when defining a constant.

use fmt;

const magic = 0xdeadbeef;

export fn main() void = {
	fmt::println(magic)!;

	const n = 1000000z;
	fmt::println(n)!;

	const neg = -300u32;
	fmt::println(neg / 10u32)!;

	const lang = "Hare";
	fmt::println(lang)!;
};
$ hare run constants.ha 
4/4 tasks completed (100%)
3735928559
1000000
429496699
Hare