mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
adding a filtered object comprehension test
This commit is contained in:
@@ -3,6 +3,7 @@ results: n * 2 for n in nums
|
|||||||
|
|
||||||
obj: {one: 1, two: 2, three: 3}
|
obj: {one: 1, two: 2, three: 3}
|
||||||
names: key + '!' for value, key in obj
|
names: key + '!' for value, key in obj
|
||||||
|
odds: key + '!' for value, key in obj when value % 2 isnt 0
|
||||||
|
|
||||||
# next: for n in [1, 2, 3] if n % 2 isnt 0
|
# next: for n in [1, 2, 3] if n % 2 isnt 0
|
||||||
# print('hi') if false
|
# print('hi') if false
|
||||||
@@ -10,3 +11,4 @@ names: key + '!' for value, key in obj
|
|||||||
|
|
||||||
print(results.join(',') is '2,18')
|
print(results.join(',') is '2,18')
|
||||||
print(names.join(' ') is "one! two! three!")
|
print(names.join(' ') is "one! two! three!")
|
||||||
|
print(odds.join(' ') is "one! three!")
|
||||||
Reference in New Issue
Block a user