module CallingProcs; type {public} Vector = array {math} * of integer; var nums: array {math} 4 of integer; ints: Vector; total: integer; procedure Init(): boolean; (* private by default *) begin nums := [1,2,3,4]; ints := new Vector(5); ints := [2,4,6,8,10]; return true; end Init; (* function *) procedure Sum(v: Vector): integer; var i,s: integer; begin s := 0; for i := 0 to len(v) - 1 do (* inc is a predefined subroutine *) inc(s,v[i]) end; return s end Sum; (* subroutine * @param v: by value * @param t: by reference *) procedure Sum2(v: array {math} * of integer; var t: integer); var i: integer; begin t := 0; for i := 0 to len(v) - 1 do inc(t,v[i]) end end Sum2; begin Init; (* calling a function without parameters *) total := Sum(nums); writeln(total); (* optional arguments not supported *) (* variable arguments through open arrays *) writeln(Sum(ints)); (* named arguments not supported *) ints := [1,3,5,7,9]; Sum2(ints,total); writeln(total); end CallingProcs.