Generator (computer programming): Difference between revisions

Content deleted Content added
ECMAScript: removed unnecessary blank lines
ECMAScript: simplified fibonacci function
Line 484:
// inspired by: http://wiki.ecmascript.org/doku.php?id=harmony:generators
function* fibonacci() {
let init[prev, curr] = [0, 1];
yield init;
let [prev, curr] = [0, init];
while (true) {
[prev, curr] = [curr, prev + curr];
yield curr;
let [prev, curr] = [0curr, initprev + curr];
}
}