Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(26)

Side by Side Diff: 2014/go4java/chan.go

Issue 111050043: code review 111050043: go.talks: add "Go for Javaneros" (Closed)
Patch Set: diff -r f10c43fe60f9 https://code.google.com/p/go.talks Created 9 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 package main
2
3 import (
4 "fmt"
5 "time"
6 )
7
8 func sleepAndTalk(secs time.Duration, msg string, c chan string) {
9 time.Sleep(secs * time.Second)
10 c <- msg
11 }
12
13 func main() {
14 c := make(chan string)
15
16 go sleepAndTalk(0, "Hello", c)
17 go sleepAndTalk(1, "Gophers!", c)
18 go sleepAndTalk(2, "What's", c)
19 go sleepAndTalk(3, "up?", c)
20
21 for i := 0; i < 4; i++ {
22 fmt.Printf("%v ", <-c)
23 }
24 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b