Thank you both for your help!
Probably I will either use the getArrayLength function or pass the array length as a parameter.
These are the best solutions I can think of at the moment.