progs/fun2/sqr.fun
author Christian Urban <christian.urban@kcl.ac.uk>
Sun, 01 Oct 2023 13:35:51 +0100
changeset 933 4d9674598682
parent 854 c9e2568d4729
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()
};

all(0)