Skip to content

Instantly share code, notes, and snippets.

@NaelsonDouglas
Last active August 9, 2018 22:45
Show Gist options
  • Save NaelsonDouglas/4ab0a1fcdb1100c159e0c057e064116f to your computer and use it in GitHub Desktop.
Save NaelsonDouglas/4ab0a1fcdb1100c159e0c057e064116f to your computer and use it in GitHub Desktop.
function producer()
ch = Channel{Any}(1)
@async begin
for i=1:5
put!(ch,i)
end
close(ch)
end
return ch
end
ch = producer()
take!(ch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment