10 Jan 2005 08:58
Re: Another vote for for loops
On 10 Jan 2005, at 03:20, Mark Igra wrote: > Just wanted to add another vote for traditional for loops. > > I'm translating code like this: > > for (int i = 0; i < nRemaining; i++) > do something > > The suggestions I saw in the archive for using > > for (i in 0...nRemaining) > > don't work in the case where nRemaining is 0. For example this: > > for(i in 0...0) > println i; > > prints this: > 0 > -1 > > which is pretty inexplicable. That looks like a bug in the use of ... which we should fix. In the mean time until we fix it, you could use a while() loop. James ------- http://radio.weblogs.com/0112098/
RSS Feed