Home / Highlights / FAQ / Examples / Quick Start / Roadmap / Download / About Us
main()
{
	int v = 2 //C style declares are mutable
	double_me(v mut) //'mut' must be written on params that may change
	assert(v == 4)

	a, b = plus_minus(5, 2)
	assert(a==7 && b == 3)
	c = plus_minus(20, 5)
	d, e := c
	assert(d==25 && e == 15)

	result := double_array([5, 2, 1])
	assert(result == [10, 4, 2])
	if result.size < 3 return //need a bounds check for next line
	result[0] = 123
	assert(result == [123, 4, 2])
	
	int_value = fnWithError(false) error {
		//error handling code here
		//In the future you can assign to int_value and not need to return
		return
	}
}
double_me(int value mut) { value *= 2 }
plus_minus(int a, b) int, int { return a+b, a-b }

//array is passed by reference
double_array(int[] array) int[] {
	my_array := [] //shorthand for decl int[]
	for v in array {
		my_array.Push(v*2)
	}
	return my_array
}

//The '!' after int means it's an int or error
fnWithError(bool b) int! {
	if b { return InvalidParameter }
	return 0
}