input: Write a function to filter an array by a given criteria. If the given criteria is a function that evaluates to True or False on each element of the array, return a new array containing only those elements for which the criteria function returns True. 
  
  def filter_array(array, criteria):
    filtered_array = []
    for value in array:
      if criteria(value):
        filtered_array.append(value)
    return filtered_array
  
  criteria = lambda x: x % 5 == 0
  array = [1, 2, 5, 10, 15, 20, 25, 30]
  assert filter_array(array, criteria) == [5, 10, 15, 20, 25, 30]
  
  criteria = lambda x: x < 10
  array = [1, 2, 5, 10, 15, 20, 25, 30]
  assert filter_array(array, criteria) == [1, 2, 5]
  
  criteria = lambda x: x % 2 == 0
  array = [1, 2, 5, 10, 15, 20, 25, 30]
  assert filter_array(array, criteria) == [2, 10, 20, 30]
  
  criteria = lambda x: x >= 20
  array = [1, 2, 5, 10, 15, 20, 25, 30]
  assert filter_array(array, criteria) == [20, 25, 30]
  
  criteria = lambda x: x < 0
  array = [1, 2, 5, 10, 15, 20, 25, 30]
  assert filter_array(array, criteria) == []
output: def filter_array(array, criteria):
    filtered_array = []
    for value in array:
      if criteria(value):
        filtered_array.append(value)
    return filtered_array