Last active
October 3, 2017 12:20
-
-
Save ceremcem/6ed388e1f8ad7c3c83ea5b75d5dbaf15 to your computer and use it in GitHub Desktop.
Livescript async `for-loop` example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sleep = (ms, f) -> set-timeout f, ms | |
console.log "started" | |
<~ sleep 1000ms | |
i = 0; _count = 5 | |
<~ :lo(op) ~> | |
console.log "hello", i | |
return op! if ++i >= _count | |
<~ sleep 1000ms | |
lo(op) | |
<~ sleep 1000ms | |
console.log "ended" | |
# try it out at http://livescript.net/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment