Length won't work in a function

I have a fairly simple custom function. It takes two inputs (an int[] and an int) and returns an int[]. It takes the length of the int[] input, however it gives the error The variable "length" does not exist

Here is all of the code:


  int[] Chromatic(int[] converter,int range) {
    for(int i = 0; i < length.converter; i++) {
      converter[i] = converter[i] % range;
    }
    return converter;

What is the issue?

Thanks in advance for any and all responces.

1 Like

length is an array field, not a variable: Processing.org/reference/Array.html

Use the accessor operator dot . in order to access field length over an array’s reference:
Processing.org/reference/dot.html

length.converter -> converter.length

1 Like

Thank you, now that you point that out it seems really obvious!