Back to table

SEQ Swap

The following is a valid µOCCAM program. The variables have all been declared. A swap of values is done between x and y, using z as a temp variable.

Program file: /public/cs3/web/ipptests/seq-swap.accept
INT x = 1: --declaring variables and values
INT y = 5:
INT z: --used as swap variable

SEQ
  Z := x --swapping process
  x := y 
  y := z