Junior — Middle
Millist käitumist oodatakse, kui kutsutakse välja tühi select operaator Go keeles?
sobes.tech AI
Vastus AI-lt
In the Go language, the select operator is used to work with multiple channels simultaneously. If an empty select (i.e., without any case) is called, execution will be blocked forever, because there are no channels for reading or writing, and no default case.
Example:
select {
// empty select
}
This code will cause the goroutine to block, as select waits for at least one available channel or a default to continue.