CSC300: Induction: Is this function useful? [8/37] Previous pageContentsNext page

01
02
03
04
05
06
07
08
09
public static boolean someTrue (boolean[] a) {
  boolean result = false;
  int i = 0;
  while (i < a.length) {
    if (a[i]) result = true;
    i++;
  }
  return result;
}

What about this?

Previous pageContentsNext page