Back to table

Non constant in VAL

The following is an invalid µOCCAM program. A VAL declartion which has a non constant expression has been used.

Program file: /public/cs3/web/ipptests/non-constant-VAL.reject
INT d:
VAL pi IS 3:
VAL r IS d / 2: -- d can't be calculated at compile time
INT a:
INT c:
  stdin ? d
  INT r2 = r * r:
    a := pi * r2
    c := pi * d
  stdout ! c
  stdout ! a