Skip to content

Instantly share code, notes, and snippets.

@kenmazaika
Created November 5, 2020 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenmazaika/0248c5aa367798b96d985c0a92de24b4 to your computer and use it in GitHub Desktop.
Save kenmazaika/0248c5aa367798b96d985c0a92de24b4 to your computer and use it in GitHub Desktop.
func add(a: Int, b: Int) {
a + b
}
func mult(a: Int, b: Int) {
a * b
}
func combine(a: Int, b: Int, comp: (Int, Int) => Int) {
comp(a, b)
}
println(combine(1,2, add))
println(combine(10,20, mult))
//func c(fn: (Int) => Int, number: Int) = fn(number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment