aboutsummaryrefslogtreecommitdiff
path: root/examples/learn/18-o3.zc
blob: 9e591ed6e49ad2721d5eb8fd4f0fefb459abcbce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
namespace;
include rt;
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 = rt.new(fixed int[?], 5);
	for (int i = 0; i < 5; i++) a[i] = i * i;
	rt.put_n(sum(a)); rt.put_c(10);
	o3 int hits = 0;
	o3 { for (int i = 0; i < 1000; i++) if (i % 7 == 3) hits++; }
	rt.put_n(hits); rt.put_c(10);
}