Hare by Example: Values

Hare has all the basic type you expect. Note the bit sizes for the integers and floats.

use fmt;

export fn main() void = {
	// Integers
	fmt::println(1+1)!;

	// Floats
	fmt::println(7.0/3.0)!;

	// Value types can be made explictly too

	// 32 and 64 bit signed integers
	fmt::println(1i32 + 2i32, 4i64 * -2i64)!;

	// 32 and 64 bit unsigned integers
	fmt::println(1u32 + 2u32, 4u64 * 2u64)!;

	// size integers are usually seen in for-loops counters
	// and indicating the length, count, or size of buffers
	fmt::println(1z + 2z, 4z * 2z)!;
};
$ hare run values.ha
4/4 tasks completed (100%)
2
2.3333333333333335
3 -8
3 8
3 8