Back to table

Testing while

The following is a valid µOCCAM program. This sample program tests correctly comments, variable declarations and while loops

Program file: /public/cs3/web/ipptests/while.accept
		

-- for extra stimulation there are some blank spaces and tabs at the start!
INT l:
INT i:
INT z:
INT y:
INT rocks:

PAR
  -- the world
  SEQ
    l := 1
    i := 2
    z := 4
    y := 8
    WHILE y > 4
      IF
        i < 3
          rocks := 99
        z = 4
          i := i - 1
        l = 1
          y := y - 2