[Swift-devel] iterate behavior

Mihael Hategan hategan at mcs.anl.gov
Tue Jul 5 14:12:34 CDT 2011


On Tue, 2011-07-05 at 13:53 -0500, Jonathan Monette wrote:
> I do not think it should be like that.  I understand why it would do that.  The java code for that would be:
> 
> int i = 0;
> do
> {
>     System.out.println( i );
> } while( i++ <= 2 );
> 
> but in my opinion the increment of i should be done before the check.

Smells right to me. I think that the while/until at the end suggests
that the test is the latest thing to happen in an iteration (i.e. after
the increment).





More information about the Swift-devel mailing list