solutions/cw5/sqr.fun
changeset 894 02ef5c3abc51
parent 869 81ee93b87258
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/solutions/cw5/sqr.fun	Fri Nov 04 12:07:40 2022 +0000
@@ -0,0 +1,15 @@
+val Max : Int = 10;
+
+def sqr(x: Int) : Int = x * x;
+
+def all(n: Int) : Void = {
+  if n <= Max
+  then { print_int(sqr(n)) ; new_line(); all(n + 1) }
+  else skip()
+};
+
+{
+  print_string("Squares");
+  new_line();
+  all(0)
+} 
\ No newline at end of file