D06_Triplet.sleela
tutorial/demos/src/D06_Triplet.sleela · 21 line(s) · sleela
#sleela 2.1
// D06_Triplet.sleela — companion to Lesson 06 (The triplet: Java, Sleela, C).
// The SAME source renders to java | sleela | c by switching target-language in
// the sheet. square() is the classic method that reads identically in all three.
class D06_Triplet {
int square(int n) {
return n * n;
}
void main() {
print("== Lesson 06: one source, three targets ==");
int i = 1;
while (i <= 4) {
print("square(" + i + ") = " + square(i));
i = i + 1;
}
print("done");
}
}