Skip to content

Instantly share code, notes, and snippets.

@ericwindmill
Last active May 10, 2020 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericwindmill/510e84f2bf31e395073aff739046d02f to your computer and use it in GitHub Desktop.
Save ericwindmill/510e84f2bf31e395073aff739046d02f to your computer and use it in GitHub Desktop.
fbe_dart_iterable_loops
Try using a `for in` loop.
List<int> _doubler(List<int> nums) {
// your code here
}
List<int> _doubler(List<int> nums) {
for (var n in nums) {
n = n*2;
}
return nums;
}
var nums = [1, 2, 3];
void main() {
final _doubled = _doubler(nums);
for (var item in _doubled) {
if (_doubled.contains(item)) {
continue;
} else {
_result(false, ["The solution should include [2,4,6]"]);
}
}
_result(true, ["Good work, fam"]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment