Check if a multi-dimensional array is empty #94
-
If I have an array like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Solved here: https://stackoverflow.com/a/68160416/8456445 Multi dimensional arrays in vala are not arrays of arrays. For example this would be a compiler error:
The compiler expects 4 elements, but in the second intializer 5 elements are given. The length method for a multi dimensional array will give you the size of the dimensions:
This outputs 1, 0 because the two dimesional array extends one element in the first dimension and zero elements in the second dimension. So in the above example the array is not empty. It contains 1 row with 0 columns. You can add additional rows, but those also have to have 0 columns. |
Beta Was this translation helpful? Give feedback.
Solved here: https://stackoverflow.com/a/68160416/8456445
Multi dimensional arrays in vala are not arrays of arrays. For example this would be a compiler error:
The compiler expects 4 elements, but in the second intializer 5 elements are given.
The length method for a multi dimensional array will give you the size of the dimensions:
This outputs 1, 0 because the two dimesional array extends one element in the first dimension and zero elements in the second dimension.
So in the above exampl…