Domanda

From this documentation: http://mozart.github.io/mozart-v1/doc-1.4.0/loop/node1.html

I get the basic loop usage for iteration:

for X in SomeList do
   % ...
end

And numbers:

for X in x..y do
   % ...
end

But the "features" that are explained has no examples. It just says that you break by "break:B" and continue by "continue:C" but it gives no examples of how to use this in actual code. I assumed this was meant:

local X in
   break:X

   for Y in 1..5 do
      {Browse Y}

      if Y > 3 then {X} end
   end
end

But break:X is not a valid statement.

Could somebody please give me some examples of how to use features like "break:B" and "while:E".


Failed attempt after comment from wmeyer:

local X in
   X = {NewCell [1 2 3 4 5 6 7 8 9 0]}
   for while:@X\=nil do
      {Browse @X.1}
      @X := @X.2
   end
end

Parse error on the for ... line. How do I use the while feature?

È stato utile?

Soluzione

The loop "features" must be specified in the for-loop itself.

for Y in 1..5 break:X do
    {X}
end

(As far as I remember. I did not test this.)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top