ceylon/ceylon-spec — Issue #171: Issue with ranges and iteration
Author: FroMage
Created: 2012-02-09 12:45:04+00:00
State: open
Labels: improvement

While trying to iterate over a Java collection I'm doing this:

```ceylon
for(Integer i in 0..list.size()-1){
}
```

But this is wrong because if size is zero, I get a range of {0,-1}. In order to check for emptiness I need to surround this with an `if`. Do we have a better idiom for such iterations? Not specific to Java collections, which I assume we'll have a glue library to let us iterate them or wrap them.