Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jeeyoungk on github.
  • I am jee (https://keybase.io/jee) on keybase.
  • I have a public key whose fingerprint is 4ABA 0FEA 02E4 6B57 C136 DD68 AAF9 F10E D562 9E8C

To claim this, I am signing this object:

@jeeyoungk
jeeyoungk / main.go
Last active July 7, 2019 01:37
Go - Selecting channels with priorities (solution)
func SelectWithPriorities(highPri <-chan int, lowPri <-chan int) int {
select {
case val := <-highPri:
return val
default:
select {
case val := <-highPri:
return val
case val := <-lowPri:
return val
select {
case val := <-highPri:
return val
case val := <-lowPri:
return val
}