Created
May 9, 2017 21:38
-
-
Save chalin/9ab0406003c8ba8c727861c9468ba158 to your computer and use it in GitHub Desktop.
Todo-list generator for webdev.dartlang.org/guides/get-started
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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