Back to table

Out Of Scope

The following is an invalid µOCCAM program. The the statement a = a + b is outside the scope of the declaration of b. The program should therefore be rejected.

Program file: /public/cs3/web/ipptests/outofscope.reject
INT a = 1 + 2 :
SEQ
  INT b = 2 :
  INT c :
  c := 4
  b := b + 7      -- This is legal
a := a + b  -- But this isn't as b no longer in scope