Skip to content

Instantly share code, notes, and snippets.

@botic
Last active December 7, 2015 12:20
Show Gist options
  • Select an option

  • Save botic/a3ee38b4c0dbaa711954 to your computer and use it in GitHub Desktop.

Select an option

Save botic/a3ee38b4c0dbaa711954 to your computer and use it in GitHub Desktop.
RingoJS - Iterators and Generators
Philipps-MBP:~ philipp$ ringo
>> function* foo(a) { a = a + 1; yield a; }
SyntaxError: missing ( before function parameters.
<stdin>, line 14: missing ( before function parameters.
function* foo(a) { a = a + 1; yield a; }
^
>> function foo(a) { a = a + 1; yield a; }
>> var x = foo(1);
>> x.next();
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment