|
Re: standard for loop: msg#00195lang.groovy.user
Scott, You can just use a range, such as 1...3 for (i in 1..3) { println i } 1 2 3 You can use a suitable variable in a range, too, of course, so: foo = ['a', 'b', 'c'] for (i in 0...foo.size()) { println i } a b c If you use the '..' operator for a range, the high value of the range is included, whereas the '...' operator does not include it. So, '..' with the upper bound being the collection length works like the usual for loop "< length" idiom. - Ken On Nov 29, 2004, at 11:17 PM, Scott Stirling wrote: Hi,
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: standard for loop, Dion Almaer |
|---|---|
| Next by Date: | Re: standard for loop, Ken Pelletier |
| Previous by Thread: | RE: standard for loop, Steven Buroff |
| Next by Thread: | Re: standard for loop, Ken Pelletier |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |