Tenet playground
This tests the Javascript-based interpreter; this generates a simple times table.
fun pad(n: Int): Str {
let s = int-to-str(n);
return n lt 10 ? { true -> " " ++ s; false -> s };
}
do {
let mut c = 1;
let mut title = " |"
while c lt 10 {
title ++= " ";
title ++= pad(c);
c += 1;
}
print-line(title);
print-line("-------------------------------");
let mut r = 1;
while r lt 10 {
let mut c = 1;
let mut line = pad(r) ++ " |";
while c lt 10 {
line ++= " ";
line ++= pad(c * r);
c += 1;
}
print-line(line);
r += 1;
}
}