Created
May 2, 2020 18:00
-
-
Save ericwindmill/39032eadecb31028079f55a35d32f45f to your computer and use it in GitHub Desktop.
Iterable-listToUpperCase
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
Try using Iterable.map to change every item in a list. |
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
List<String> listToUpperCase(Iterable<String> items) { | |
// your code here | |
} |
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
List<String> listToUpperCase(Iterable<String> items) { | |
return items.map((String i) => i.toUpperCase()); | |
} |
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
var items = [ | |
'Salad', | |
'Popcorn', | |
]; | |
void main() { | |
final upperCased = listToUpperCase(items); | |
for (var item in upperCased) { | |
if (item == 'SALAD' || item == 'POPCORN') { | |
continue; | |
} else { | |
_result(false, [""]); | |
} | |
} | |
_result(true, [""]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment