Back to table

Non constant in count

The following is a valid µOCCAM program. This is the counterpart to "Non constant count". The count is a constant 9 but it uses a variable name defined with VAL.

Program file: /public/cs3/web/ipptests/constant-count.accept
INT i:
INT non.const = 0:
VAL const IS 9:
[10]CHAN some.input:
INT x:
INT y:
ALT i = non.const FOR const -- the count is a constant of 9
  some.input[i] ? x
    SEQ
      y := x + 2
      stdout ! y
      non.const := non.const + 1