Projet_SETI_RISC-V/riscv-gnu-toolchain/binutils/gdb/testsuite/gdb.go/chan.go
2023-03-06 14:48:14 +01:00

20 lines
378 B
Go

package main
import "fmt"
func generate() chan int {
ch := make(chan int)
go func() {
for i := 0; ; i++ {
ch <- i // set breakpoint 1 here
}
}()
return ch
}
func main() {
integers := generate()
for i := 0; i < 100; i++ { // Print the first hundred integers.
fmt.Println(<-integers) // set breakpoint 2 here
}
}