The following is a valid µOCCAM program that performs I/O. You select which times table you want, and then the program does one loop to fill the array and another to print it. The PAR bits are for variable assignments that can happen at the same time.
Program file:
/public/cs3/web/ipptests/times_tables.io
-- one times two is two, two times two is four, three times two is five, four ...
INT n:
INT current:
INT multiple:
[12]INT array:
SEQ
-- Choose which times table you want
stdin ? multiple
PAR
n:=1
current:=multiple
WHILE n<=12
SEQ
array[n]:=current
PAR
current:=current+multiple
n:=n+1
-- Now output the table
SEQ
n:=1
WHILE n<=12
SEQ
stdout ! array[n]
n:=n+1
When provided with this input:
/public/cs3/web/ipptests/times_tables.in
2
it should generate the following output:
/public/cs3/web/ipptests/times_tables.out
==> 2 ==> 4 ==> 6 ==> 8 ==> 10 ==> 12 ==> 14 ==> 16 ==> 18 ==> 20 ==> 22 ==> 24