Skip to content

Commit 3f7c736

Browse files
committed
Simplify do.coffee
This version is directly executable, and illustrates more directly the concept. One can comment out line jashkenas#3 and run again to see the difference.
1 parent ab6f69c commit 3f7c736

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

documentation/coffee/do.coffee

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
for filename in list
2-
do (filename) ->
3-
fs.readFile filename, (err, contents) ->
4-
compile filename, contents.toString()
1+
multipliers = [1, 2, 3]
2+
multiples = for j in multipliers
3+
do (j) ->
4+
(x) -> x * j
5+
6+
alert(f(2) for f in multiples)

0 commit comments

Comments
 (0)