title: Does Go allow a function to use another function as a parameter?
body: <p>The problem is happening at line 17 in the Go code. Below is the program in python and Go so you can see exactly what I'm attempting to do. Python works, my Go attempts have all failed. Already read golang.org back to back, and google turned up nothing, as well.</p>
  
  <pre><code>def my_filter(x):
    if x % 5 == 0:
      return True
    return False
  
  #Function which returns a list of those numbers which satisfy the filter
  def my_finc(Z, my_filter):
  
    a = []
    for x in Z:
      if my_filter(x) == True:
        a.append(x)
    return a
  
  print(my_finc([10, 4, 5, 17, 25, 57, 335], my_filter))
  </code></pre>
  
  <p>Now, the Go version which I'm having troubles with:</p>
  
  <pre><code>package main
  
  import "fmt"
  
  func Filter(a []int) bool {
      var z bool
      for i := 0; i &lt; len(a); i++ {
          if a[i]%5 == 0 {
              z = true
          } else {
              z = false
          }
      }
      return z
  }
  
  func finc(b []int, Filter) []int {
      var c []int
      for i := 0; i &lt; len(c); i++ {
          if Filter(b) == true {
              c = append(c, b[i])
          }
      }
      return c
  }
  
  func main() {
      fmt.Println(finc([]int{1, 10, 2, 5, 36, 25, 123}, Filter))
  }
  </code></pre>