Hacker News new | ask | show | jobs
by jashkenas 5505 days ago
@amirshim:

Yes, range comprehensions were recently optimized to remove direction-checking when possible. On CoffeeScript master ...

    x for x in [-10..10]
... compiles into:

    var x;
    for (x = -10; x <= 10; x++) {
      x;
    }
Even if the start/end values are variables, the check can be avoided by specifying the step as a number. It'll go out with the next release.
1 comments

great!