progs/fun2/sqr.fun
author Christian Urban <christian.urban@kcl.ac.uk>
Mon, 10 Oct 2022 15:15:15 +0100
changeset 888 fc812b8f120f
parent 854 ce4a7bab6bd8
permissions -rw-r--r--
texupdate

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)