-
-
Save aruld/1299218 to your computer and use it in GitHub Desktop.
main() { | |
List<String> list = new List<String>(); | |
list.add('one'); | |
list.add('two'); | |
list.add('twelve'); | |
list.forEach((element) => print(element)); | |
Set<String> set = Set.from(list); | |
set.forEach((element) => print(element)); | |
} |
I came here because of Flutter...
Created 9 years ago
thanks
yeap, Flutter 😄
thnks my dude, yup, flutter as well
What is Dart? :-)
flutter is here
LOL, this was posted 8 years ago, and everyone is just now commenting probably because of Flutter!
haha True !!
Thanks
Still Commenting!
Hey, what if we want to execute a block of comments using forEach? Would the following be valid?
list.forEach( (item) {
//do something
//do something else
});
@fourpointfour
list.forEach((item) => print(item));
is nothing else then list.forEach((item) { return print(item);});
since the return type is void, you are not using the return type anyways. So your syntax is totally valid.
cool
You can use set.forEach(print)
instead of set.forEach((element) => print(element))
Great!
Awesome!
We still use it in 2021, thanks man!
i think we should avoid using set
for variable name
BIG thanks
ありがとうございます!!!!!!!
COOL
Nice, thanks a lot!
Thanks, I don't even know dart was this old.