Created
November 22, 2023 12:23
-
-
Save yumed15/face2bd9569eda2e03c9b026ebf1d4e3 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
intStream := make(chan int) | |
go func() { | |
defer close(intStream) | |
for i:=1; i<=5; i++ { | |
intStream <- i | |
} | |
}() | |
for integer := range intStream { | |
fmt.Printf("%v ", integer) | |
} | |
// 1 2 3 4 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment