I am trying to program in occam, and I think that it is not so easy to understand because the documentation is not so good. Anyway, I hope someone to help me.
I am trying just to learn how make a simple program. A bubble sort in occam.
#INCLUDE "course.module"
[32]INT x:
INT aux:
BOOL flag:
flag:= TRUE
aux:=0
--put values on the array
SEQ k=0 for 10
x[i] = -x[i]
-- bubble sort
WHILE (flag)
SEQ i = 0 for 9
IF
x[i] > x[i+1]
aux:= x[i]
x[i]:= x[i+1]
x[i+1] := aux
flag:= false
:
I got this image on the terminal:
What is wrong with this code?
occam-pi is indentation sensitive
A few hints in the code may help and courtesy of TiO-IDE may provide a place for online experimentation: