What is the primary purpose of using channels in Go?
- Communication between goroutines
- Data sharing between functions
- Exception handling in Go
- Synchronization of goroutines
Channels in Go are primarily used for communication between goroutines. They provide a way for goroutines to communicate and synchronize their execution by passing data between them in a safe and synchronized manner.
Loading...
Related Quiz
- How can you prevent compiler optimizations from eliminating the code you are trying to benchmark?
- A struct in Go is a collection of _____
- How do you initialize a new module in Go?
- How can you set file permissions when creating a new file in Go?
- How would you design an error handling strategy for a large-scale Go application?