Content deleted Content added
Pi Delport (talk | contribs) m Ruby's "yield" is not related to generators |
Pi Delport (talk | contribs) replace somewhat opaque Python example with something more illustrative (hopefully) |
||
Line 13:
<pre>
def
yield
# Example use: printing out the integers from 10 to 20.
# Note that this iteration terminates normally, despite countfrom() being
# written as an infinite loop.
for i in countfrom(10):
if i <= 20:
print i
else:
break
</pre>
|