How to create 2D list (matrix) in Dart

1 Answer

0 votes
import 'dart:io';

void main() {
    List<List<int>> matrix = [  [0, 2, 4, 6, 1], 
                                [1, 5, 4, 1, 1], 
                                [7, 1, 0, 8, 0], 
                                [9, 3, 8, 1, 1]  ];
                                    
    stdout.write(matrix);
}




/*
run:

[[0, 2, 4, 6, 1], [1, 5, 4, 1, 1], [7, 1, 0, 8, 0], [9, 3, 8, 1, 1]]

*/

 



answered Apr 18, 2023 by avibootz

Related questions

2 answers 104 views
1 answer 66 views
66 views asked Oct 9, 2022 by avibootz
1 answer 68 views
68 views asked Oct 9, 2022 by avibootz
...