[Swift-devel] iterate behavior

Daniel S. Katz dsk at ci.uchicago.edu
Tue Jul 5 13:46:12 CDT 2011


This seems right to me.  When i = 2, the until is false so the next iteration takes place.  Then i = 3 and the until is true, so the structure stops.

On the other hand,
iterate i {
  trace(i);
} while (i <= 2);

would not have a trace at 3, in my opinion...

Dan


On Jul 5, 2011, at 1:39 PM, Mihael Hategan wrote:

> I have
> 
> iterate i {
>  trace(i);
> } until (i > 2);
> 
> I read that "until" as "the iteration body should not be run if i > 2",
> and yet trace goes up to 3. And I'm not sure if that's the right way to
> go.
> 
> Discuss...
> 
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel

-- 
Daniel S. Katz
University of Chicago
(773) 834-7186 (voice)
(773) 834-6818 (fax)
d.katz at ieee.org or dsk at ci.uchicago.edu
http://www.ci.uchicago.edu/~dsk/







More information about the Swift-devel mailing list