Get out of a for/select loop without using labels:
func main() {
OUT:
for {
select {
case ... ):
...
default:
break OUT
}
}
....
}
Refactoring out the for loop:
func main() {
...
doSomething()
...
}
func doSomething() {
for {
select {
case ...:
...
default:
return
}
}
}
No comments:
Post a Comment