solution/cw5/sqr.fun
changeset 894 4d5058706f1b
parent 893 908e4f6cdf7c
child 895 550676e542d2
equal deleted inserted replaced
893:908e4f6cdf7c 894:4d5058706f1b
     1 val Max : Int = 10;
       
     2 
       
     3 def sqr(x: Int) : Int = x * x;
       
     4 
       
     5 def all(n: Int) : Void = {
       
     6   if n <= Max
       
     7   then { print_int(sqr(n)) ; new_line(); all(n + 1) }
       
     8   else skip()
       
     9 };
       
    10 
       
    11 {
       
    12   print_string("Squares");
       
    13   new_line();
       
    14   all(0)
       
    15 }