3 ms·
@amirshim: Yes, range comprehensions were recently optimized to remove direction-checking when possible. On CoffeeScript master ... x for x in [-10..10]
by jashkenas 15y 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.
- amirshim 15y agogreat!