The following is a valid µOCCAM program that performs I/O. A simple program to calculate the factorial of a number. It outputs the value at each stage, therefore the last value outputed is the result.
Program file:
/public/cs3/web/ipptests/fact.io
INT x:
INT fact:
SEQ
stdin ? x
fact := x
WHILE x<>1
SEQ
x:=x-1
fact := fact * x
stdout ! fact
When provided with this input:
/public/cs3/web/ipptests/fact.in
5
it should generate the following output:
/public/cs3/web/ipptests/fact.out
==> 20 ==> 60 ==> 120