Using Advanced Generator Methods
In this lesson, you’ll learn about the advanced generators methods of
.close(). To practice with these new methods, you’re going to build a program that can make use of each of the three methods.
As you follow along in the lesson, you’ll learn that
yield is an expression, rather than a statement. You can use it as a statement, but you can manipulate a yielded value. You are allowed to
.send() a new value back to the generator. You’ll also handle exceptions with
.throw() and stop the generator after a given amount of digits with
Comments & Discussion
Become a Member to join the conversation.