Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

sum of a list using for loop in dart

main(List<string> args) {
  var sum = 0;
  var given_list = [1, 2, 3, 4, 5];

  for (var i = 0; i < given_list.length; i++) {
    sum += given_list[i];
  }

  print("Sum : ${sum}");
}
Source by www.codevscolor.com #
 
PREVIOUS NEXT
Tagged: #sum #list #loop #dart
ADD COMMENT
Topic
Name
5+4 =