Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

Ascending order with for loop in dart

   List<int> a = [1000, 500, 700, 7000, 1 , 2, 4 ,3];

     for (var i = 1; i < a.length; i++)
       for (var j = 0; j < i; j++)
         if (a[i] < a[j]) {
           var x = a[i];
           a[i] = a[j];
           a[j] = x;
         }

      print(a);
 
PREVIOUS NEXT
Tagged: #Ascending #order #loop #dart
ADD COMMENT
Topic
Name
4+4 =