diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/Iterator.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/library/scala/Iterator.scala b/src/library/scala/Iterator.scala index fd8992fb1d..0e6c9bb4ac 100644 --- a/src/library/scala/Iterator.scala +++ b/src/library/scala/Iterator.scala @@ -112,7 +112,9 @@ object Iterator { * @param end the end value of the iterator * @return the iterator with values in range <code>[start;end)</code>. */ - def range(start: Int, end: Int): Range = range(start, end, 1) + def range(start: Int, end: Int): Range = + if (start < end) range(start, end, 1) + else range(start, end, -1) /** Create an iterator with elements * <code>e<sub>n+1</sub> = e<sub>n</sub> + step</code> |