Skip to content

Instantly share code, notes, and snippets.

@ad3n
Created July 2, 2022 23:00
Show Gist options
  • Save ad3n/fe9dc2747ac93cb5c92e96e72e9c66ca to your computer and use it in GitHub Desktop.
Save ad3n/fe9dc2747ac93cb5c92e96e72e9c66ca to your computer and use it in GitHub Desktop.
package main
import "fmt"
func doubling(n int) int {
return 2 * n
}
func main() {
cNumber := make(chan int)
for i := 0; i <= 10; i++ {
go func(i int) {
//TODO
}(i)
}
for i := 0; i <= 10; i++ {
var n int
n = <-cNumber
fmt.Println(doubling(n))
}
go func() {
for i := 0; i <= 10; i++ {
//TODO
}
}()
for i := 0; i <= 10; i++ {
var result int
result = doubling(<-cNumber)
fmt.Println(result)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment