This example is a simple case related to my question.
Case 1: declaring out of the loop
List<List<int>> matrix = [[1,2,3],[4,5,6],[7,8,9]];
List<int> o;
for(int i=0; i<matrix.length; i++) {
o = List.from(matrix[i]);
for(int e in o)
print(e);
}
Case 2: declaring inside the loop
List<List<int>> matrix = [[1,2,3],[4,5,6],[7,8,9]];
for(int i=0; i<matrix.length; i++) {
List<int> o = List.from(matrix[i]);
for(int e in o)
print(e);
}
Does it matter where I declare the variable? Why?