You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there! First, I want to say thanks for a great features overview. GeneratorFunctionIteratorProtocol good as example of generator but not fully correct Fibonacci numbers.
An output of this example is 1, 2, 3, 5, 8, 13 ...
And should be: 1, 1, 2, 3, 5, 8, 13
Yield can be placed before calculating the next iteration.
...
for (;;) {
yield cur;
[ pre, cur ] = [ cur, pre + cur ]
}
...
The text was updated successfully, but these errors were encountered:
Hi there! First, I want to say thanks for a great features overview.
GeneratorFunctionIteratorProtocol good as example of generator but not fully correct Fibonacci numbers.
An output of this example is 1, 2, 3, 5, 8, 13 ...
And should be: 1, 1, 2, 3, 5, 8, 13
Yield can be placed before calculating the next iteration.
The text was updated successfully, but these errors were encountered: