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

4

1 回答 1

3

这里的问题是缺少Test. 如果要定义不返回任何内容的“函数”,请使用proc关键字:

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

L = [1 2 3 4 5]
{Test L}
于 2014-03-27T09:18:52.640 回答