mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
adding a negative range comprehension test.
This commit is contained in:
parent
7402aea9f2
commit
8cdd8de360
1 changed files with 6 additions and 0 deletions
|
@ -39,6 +39,12 @@ results: x for x in [0..25] by 5
|
|||
ok results.join(' ') is '0 5 10 15 20 25'
|
||||
|
||||
|
||||
# And can loop downwards, with a negative step.
|
||||
results: x for x in [5..1] by -1
|
||||
|
||||
ok results.join(' ') is '5 4 3 2 1'
|
||||
|
||||
|
||||
# Multiline array comprehension with filter.
|
||||
evens: for num in [1, 2, 3, 4, 5, 6] when num % 2 is 0
|
||||
num *= -1
|
||||
|
|
Loading…
Add table
Reference in a new issue