Skip to content

Instantly share code, notes, and snippets.

@RafalFilipek
Created December 12, 2013 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RafalFilipek/9335e3564b34ad878fd3 to your computer and use it in GitHub Desktop.
Save RafalFilipek/9335e3564b34ad878fd3 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
var counter = 0
var c = make(chan string)
func Prnt(c chan string) {
for {
fmt.Printf("Powiedziałeś: %s\n", <-c)
}
}
func Read(c chan string) {
for {
var s string
_, err := fmt.Scanf("%s", &s)
if err == nil {
c <- s
}
}
}
func main() {
go Prnt(c)
Read(c)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment