Solidity has a special array property called .length
that returns the Length of an Array.
array.length
The length of an Array is the total number of indexes, positions, or values in that array.
Let's say you have an array called values
containing integers as below:
int[] values = [15, 10, 14, 45]
To get the length of values
, you can write:
uint len = values.length
The variable len
is now the length of values
in this case 4 (an unsigned integer).
Hope that helps.
Top comments (0)