Golang Channel Function Parameters | Challenge

GoGoBeginner
Practice Now

This tutorial is from open-source community. Access the source code

Introduction

This challenge aims to test your understanding of using channels as function parameters in Golang.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL go(("`Go`")) -.-> go/ConcurrencyGroup(["`Concurrency`"]) go/ConcurrencyGroup -.-> go/channels("`Channels`") subgraph Lab Skills go/channels -.-> lab-15377{{"`Golang Channel Function Parameters | Challenge`"}} end

Channel Directions

The problem to be solved in this challenge is to modify the given code to ensure that the channels used as function parameters are specified to only send or receive values.

Requirements

  • Basic knowledge of Golang
  • Understanding of channels and their usage in Golang

Example

$ go run channel-directions.go
passed message

Summary

In this challenge, you learned how to specify if a channel is meant to only send or receive values, which increases the type-safety of the program.

Other Go Tutorials you may like