Created
May 16, 2022 11:24
-
-
Save Chinecherem20199/2c69e91b19156309adac215f7b17cb00 to your computer and use it in GitHub Desktop.
forEach_map_function
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() { | |
final list = [10, 20, 33]; | |
// for (var item in list) { | |
// print(item); | |
// } | |
//forEach | |
list.forEach((item) => print(item)); | |
list.forEach(print); | |
//Map Function | |
var halves = list.map((value) => value / 2).toList(); | |
for (var item in halves) { | |
print(item); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment