input: Write a function to filter an array by a given criteria. The function should iterate through the array, check each element against the criteria, and return a new array containing only the elements that match the criteria.
  
  def filter_array(array, criteria):
   filtered_array = []
   for value in array:
    if criteria(value):
     filtered_array.append(value)
   return filtered_array
  
  def criteria(x):
   return x % 5 == 0
  
  assert filter_array([1, 2, 5, 10, 15, 20, 25, 30], criteria) == [5, 10, 15, 20, 25, 30]
  assert filter_array([3, 7, 13, 18], criteria) == []
  assert filter_array([10, 20, 30, 40], criteria) == [10, 20, 30, 40]
  assert filter_array([], criteria) == []
  assert filter_array([1, 3, 5, 7, 9, 10], criteria) == [5, 10]
output: def filter_array(array, criteria):
   filtered_array = []
   for value in array:
    if criteria(value):
     filtered_array.append(value)
   return filtered_array