Concurrent computing: Difference between revisions

Content added Content deleted
m (Updated code to match task and removed output as defined by task.)
m (Removed output as defined by task, updated code to match task)
Line 716: Line 716:
multiple channel operations.
multiple channel operations.
<lang go>package main
<lang go>package main

import "fmt"
import "fmt"

func main() {
func main() {
w1 := make(chan bool, 1)
w1 := make(chan bool, 1)
Line 731: Line 729:
select {
select {
case <-w1:
case <-w1:
fmt.Println("Enjoy")
fmt.Println("A")
case <-w2:
case <-w2:
fmt.Println("Rosetta")
fmt.Println("B")
case <-w3:
case <-w3:
fmt.Println("Code")
fmt.Println("C")
}
}
}
}
}
}
}</lang>
}</lang>
Output:
<pre>
Code
Rosetta
Enjoy

Enjoy
Rosetta
Code

Rosetta
Enjoy
Code
</pre>


=={{header|Groovy}}==
=={{header|Groovy}}==