The following is a valid µOCCAM program. This program tests the while loops capability of handling assignments and outputting them. The program calculates 8+..+1 and outputs the result at every stage. It then outputs the value of y - x = 36-10 = 26.
SEQ INT x := 0 INT y := 10 WHILE x < 8 SEQ x := x + 1 y := y + x stdout ! y x := y - x stdout ! x