Skip to content

Instantly share code, notes, and snippets.

@chalin
Created May 9, 2017 21:38
Show Gist options
  • Save chalin/9ab0406003c8ba8c727861c9468ba158 to your computer and use it in GitHub Desktop.
Save chalin/9ab0406003c8ba8c727861c9468ba158 to your computer and use it in GitHub Desktop.
Todo-list generator for webdev.dartlang.org/guides/get-started
void main() {
thingsTodo().forEach(print);
}
Iterable<String> thingsTodo() sync* {
var actions = ['Walk', 'Wash', 'Feed'];
var pets = ['cats', 'dogs'];
for (var action in actions) {
for (var pet in pets) {
if (pet == 'cats' && action != 'Feed') continue;
yield '$action the $pet';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment