Aufgabe3/simple1to10.go hinzugefügt

main
Jan Bachmann 2024-12-03 10:31:57 +01:00
parent 26ad489db8
commit 6e2ad84bb7
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package main
import "fmt"
func count(ch chan int) {
for i := 1; i <= 10; i++ {
ch <- i
}
close(ch)
}
func main() {
channel := make(chan int)
go count(channel)
for num := range channel {
fmt.Println(num)
}
}