Higher Order Functions

A higher order function is a function that takes a function as an argument, or returns a function. Higher order function is in contrast to first order functions, which don’t take a function as an argument or return a function as output.

Examples Filter
fn sqr(n int) int {
	return n * n
}

fn run(value int, op fn(int) int) int {
	return op(value)
}

fn main()  {
	println(run(5, sqr)) // "25"
}