Created
November 5, 2020 18:45
-
-
Save kenmazaika/0248c5aa367798b96d985c0a92de24b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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