Skip to content

Instantly share code, notes, and snippets.

@mohayonao
Last active December 29, 2015 18:59
Show Gist options
  • Save mohayonao/7714168 to your computer and use it in GitHub Desktop.
Save mohayonao/7714168 to your computer and use it in GitHub Desktop.
# origin
Task ->
a = b = c = 100
if a
[ 1, 2, 3 ].do (i)->
console.log i
1.wait()
0.5.wait()
else if b
[ 4, 5, 6 ].do (i)->
console.log i
1.wait()
0.5.wait()
else
if c
[ 7, 8, 9 ].do (i)->
console.log i
1.wait()
0.5.wait()
# replaced
Task TaskFunction ->
a = b = c = undefined
[
-> a = b = c = 100
-> if a
true.do TaskFunction ->
[
-> [ 1, 2, 3 ].do TaskFunction ->
[
(i)-> console.log i
(i)-> 1.wait()
]
-> 0.5.wait()
]
else if b
true.do TaskFunction ->
[
-> [ 4, 5, 6 ].do TaskFunction ->
[
(i)-> console.log i
(i)-> 1.wait()
]
-> 0.5.wait()
]
else
true.do TaskFunction ->
[
-> if c
true.do TaskFunction ->
[
-> [ 7, 8, 9 ].do TaskFunction ->
[
(i)-> console.log i
(i)-> 1.wait()
]
]
-> 0.5.wait()
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment