Skip to content

Instantly share code, notes, and snippets.

@ceremcem
Last active October 3, 2017 12:20
Show Gist options
  • Save ceremcem/6ed388e1f8ad7c3c83ea5b75d5dbaf15 to your computer and use it in GitHub Desktop.
Save ceremcem/6ed388e1f8ad7c3c83ea5b75d5dbaf15 to your computer and use it in GitHub Desktop.
Livescript async `for-loop` example
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