title: Concurrent routines in Google's Go Language
body: <p>Is it possible in go:
  Suppose, I have 3 concurrent routines which can send integers to each other. Now, suppose both concurrent routine 2 &amp; 3 sends an integer to concurrent routine 1. Is it possible in go that routine 1 takes both two values and process it farther ? To make it clear, I have following code:</p>
  
  <pre><code>package main
  import "rand"
  
  func Routine1(command12 chan int, response12 chan int, command13 chan int, response13 chan int ) {
  for i := 0; i &lt; 10; i++ {
      i := rand.Intn(100)
  if i%2 == 0 {
  command12 &lt;- i 
  }
  
  if i%2 != 0 {
  command13 &lt;- i 
  }
  
  print(&lt;-response13, " 1st\n");
  }
  close(command12)
  }
  
  func Routine2(command12 chan int, response12 chan int, command23 chan int, response23 chan int) {
  for i := 0; ; i++ {
      x, open := &lt;-command12
      if !open {
          return;
      }
       print(x , " 2nd\n");
      y := rand.Intn(100)
      if i%2 == 0 {
  command12 &lt;- y 
  }
  
  if i%2 != 0 {
  command23 &lt;- y 
  }
  }
  }
  
  func Routine3(command13 chan int, response13 chan int, command23 chan int, response23 chan int) {
  for i := 0; ; i++ {
      x, open := &lt;-command13
      if !open {
          return;
      }
       print(x , " 3nd\n");
      y := rand.Intn(100)
      response23 &lt;- y
  }
  }
  
  func main() {
     command12 := make(chan int)
     response12 := make(chan int)
     command13 := make(chan int)
     response13 := make(chan int)
     command23 := make(chan int)
     response23 := make(chan int)
  
     go Routine1(command12, response12,command13, response13 )
     Routine2(command12, response12,command23, response23)
     Routine3(command13, response13,command23, response23 )
  }
  </code></pre>
  
  <p>Here, in this example routine 1 can send an int to routine 2 or 3. I assume it is routine 3. Now suppose, routine 3 also send an int to routine 2. Is it possible for routine 2 to take those two values and process further (dynamic concurrent routines)? Can any body help to modify this program accordingly. </p>