aboutsummaryrefslogtreecommitdiff
path: root/examples/learn/18-o3.zc
blob: cb2237aa812dd5e3936698508580d17907562727 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
o3 int sum(fixed []int a) { int s = 0; for (int i = 0; i < len(a); i++) s += a[i]; return s; }
fn main() {
	fixed []int a = new(fixed []int, 5);
	for (int i = 0; i < 5; i++) a[i] = i * i;
	put_n(sum(a)); put_c(10);
	o3 int hits = 0;
	o3 { for (int i = 0; i < 1000; i++) if (i % 7 == 3) hits++; }
	put_n(hits); put_c(10);
	return 0;
}