-
-
Save RafalFilipek/9335e3564b34ad878fd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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