Skip to content

Instantly share code, notes, and snippets.

@kublaj
Forked from chalin/main.dart
Created January 31, 2018 09:38
Show Gist options
  • Save kublaj/0ec81fb7309a61e6ca2f3b8a1739f392 to your computer and use it in GitHub Desktop.
Save kublaj/0ec81fb7309a61e6ca2f3b8a1739f392 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