solutions/cw5/sqr.fun
author Christian Urban <christian.urban@kcl.ac.uk>
Sat, 23 Sep 2023 21:22:17 +0100
changeset 925 ddb521b57e0c
parent 894 02ef5c3abc51
permissions -rw-r--r--
updated

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)
}