W
W
wanomgn2017-08-24 10:51:05
go
wanomgn, 2017-08-24 10:51:05

How to pass multiple values ​​through a channel?

Good afternoon.
started to study golang... naturally full of questions ;-)
there is a function that returns string and map
I want to make this function a goroutine and that this goroutine would also give string and map through the channel
in all textbooks it is written that when creating a channel, the type of data that will be walk along this channel (for example, int, or string) .. but I would like both string and map to fly through the channel at once.
is this possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kmg4e, 2017-08-24
@wanomgn

Structure you create - and send it to the channel.
Just be careful with copies of objects in the map

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question