Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJan Oberreiter
78,020 PointsGoroutines and Channels
could someone please give me a hint what I am doing wrong ... I think the first two questions should be alright, but I don't get the last one ... thank you ... Jan.
package channels
func readFromChannel() string {
channel := make(chan string)
go writeToChannel(channel)
readFromChannel()
return
}
2 Answers
Nathan Williams
Python Web Development Techdegree Student 6,851 PointsYou're super close, you just need to return the channel result rather than calling the function recursively.
package channels
func readFromChannel() string {
// CREATE A CHANNEL FOR string VALUES HERE
c := make(chan string)
// HERE, CALL writeToChannel AS A GOROUTINE, AND PASS IT YOUR CHANNEL
go writeToChannel(c)
// HERE, READ A STRING FROM YOUR CHANNEL AND RETURN IT
return <- c
}
Jan Oberreiter
78,020 PointsThank you so much, Nathan ... you saved my day, that has just begun here ... I just thought ... k ... now I will spend the whole Saturday tackling this challenge, thank you so much ... best regards, Jan.