Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Nim

Visibility

unlisted

Author

legacy-anonymous

Created

2019-02-01T15:01:06Z

Updated

2019-02-01T15:01:06Z

import os,threadpool
var chan: Channel[string]
open(chan)

proc sayHello(name: string) =
  chan.send(name)

spawn sayHello("Hello")
spawn sayHello(" World!")
sync()

var helloworld: string

for i in 0 .. pred(chan.peek):
  let x = chan.recv()
  helloworld &= x


echo(helloworld)
INFO