Created
March 22, 2022 21:01
-
-
Save Deleplace/f777f8cc64021afad2706e48bd45791a to your computer and use it in GitHub Desktop.
Replace value in list
This file contains hidden or 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() { | |
var x = [ | |
"a", | |
"", | |
"foo", | |
"bar", | |
"foo", | |
]; | |
print("Before:\t x is ${x}"); | |
for (var i = 0; i < x.length; i++) { | |
if (x[i] == 'foo') x[i] = 'bar'; | |
} | |
print("After:\t x is ${x}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment