Hacker News new | ask | show | jobs
by r_sreeram 3766 days ago
> N=1 was most common

Why would somebody use "select" for this at all? I.e., if you were going to write:

  select {
    case send/receive statement:
      statement
      ...
  }
Why not just write:

  send/receive statement
  statement
  ...
What am I missing?
2 comments

I believe the GP was referring to select-with-one-case-and-a-default, like

  select {
    case <- ch:
    default:
  }
Channel send/recv is a blocking operation, select is a commonly used workaround to make it non-blocking.