1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Adding a comprehension/jump test.

This commit is contained in:
Jeremy Ashkenas 2010-12-22 09:44:59 -08:00
parent 0a48f613ec
commit a2f9f9320b

View file

@ -269,4 +269,13 @@ for y in [1, 2, 3] ->
z = y
funcs.push -> "y is #{y} and z is #{z}"
eq funcs[1](), "y is 2 and z is 2"
eq funcs[1](), "y is 2 and z is 2"
# Cancel the comprehension if there's a jump inside the loop.
result = try
for i in [0...10]
continue if i < 5
i
eq result, 10