Solution: Write Code with a Generator Pattern
Check the solution of the challenge to use the generator pattern.
We'll cover the following...
We'll cover the following...
Problem breakdown
Let’s walk through the solution step by step so we can write code that uses a generator pattern. To do this, we’ll create a struct to store and print the values.
Let’s create a generator function. The generator function will return a channel that holds the next value. Also, pass n as a parameter.