0

I want to have a for loop in my program which is written in mozart-oz. every time I try a for loop, it gives me error. I've checked the syntax and its true but it gives error. here is my code:

OZ:

declare
fun {Test L}
   for E in L do
      {Browse L}
   end
end

declare
L = [1 2 3 4 5]
{Test L}

please help.

thanks

Ramin Omrani
  • 3,673
  • 8
  • 34
  • 60

1 Answers1

3

The problem here is the missing return value of Test. If you want to define a "function" which does not return anything, use the prockeyword:

declare
proc {Test L}
   for E in L do
      {Browse L}
   end
end

L = [1 2 3 4 5]
{Test L}
wmeyer
  • 3,426
  • 1
  • 18
  • 26