The following is a valid µOCCAM program that performs I/O. A while loop that terminates once c becomes greater than 10 where c=a+b. Basically useless
Program file:
/public/cs3/web/ipptests/pointless-while-loop.io
-- This is my test program.
-- I hope you like it.
-- It doesnt do anything useful.
SEQ
INT a:
INT b = 6:
INT c:
stdin ? a -- Get a value for a
WHILE c < 10
SEQ
c := b - a
b := b + 1
a := a - 1
stdout ! c -- outputs the value of c
-- The End
When provided with this input:
/public/cs3/web/ipptests/pointless-while-loop.in
5
it should generate the following output:
/public/cs3/web/ipptests/pointless-while-loop.out
==>11