Create multiple variables inside for loop

 A Programming Language Called Dart. What is it and how is it used?


Use object :

void main() {
var scope = {};
for(var i = 0; i < 5; i++){ 
  scope['counter' + i.toString()] = 0;   // create scope.counter1, scope.counter2,...)
}
  print(scope);
}

Post a Comment

Previous Post Next Post

Subscribe Us


Get tutorials, Flutter news and other exclusive content delivered to your inbox. Join 1000+ growth-oriented Flutter developers subscribed to the newsletter

100% value, 0% spam. Unsubscribe anytime