REALLY basic functions problem

Chrisir,

You’re a superhero. Thanks so much. I did what you said and it works. Just on your alternative suggestion, that seems to be fitting the brief much better. That was what I wanted to use initially, but when I try to use the “int” as the returnType (and say “return (MIN)”) it tells me “This method must return a result of type int”.

Also, how would I call the variable MIN_local, if this was the way I was doing it? Am I close with this?
It’s saying “MIN_local cannot be reolved to a variable”.

int a[]= new int [50];
int MIN= 990;

void setup()
{
  size(450, 450);

  for (int i=0; i < a.length; i++)
  {
    a[i] = (int) random (90, 255);
    print(a[i]+" , ");
//    println("MIN+", MIN);
  }
  
MIN = getArrayMin();

if (MIN>40){
  fill(0);
}

}


void draw() {
  fill (MIN);
  textSize(width/4);
  ellipse(width/2, height/2, width/2, height/2);

  fill (240);
  textSize(width/4);
  text(MIN, width*.28, height*.58);

}

int getArrayMin() {
  for (int i=0; i<a.length; i++)
  {
    if (a[i]< MIN) {
      MIN_local=(a[i]);
      return (MIN_local);
    }
  }
}