//An example showing prime number testing.
//This shows how the compiler can cope
//with procedures and mathematical
//functions with ints. Additionally,
//it can handle strings and string
//manipulation.
proc show(n, d)
print n, " = ", n/d, " * ", d, ;
end;
loop
print "Enter a number (0 to end):";
int n = read;
if n = 0 then return end;
if n % 2 = 0 then
show(n, 2)
else
int d = 3;
loop
if n % d = 0 then
show(n, d);
break
elif d > n/2 then
print n, " is prime", ;
break
else
d = d + 2
end;
end
end
end