package main
import “fmt”
func main() {
fmt.Println(squareMinusNum(square, 8))
}
func square (int num) int {
return num*num
}
func squareMinusNum (f(int num) int, num int) int{
x:= f(num)-num
return x
}
package main
import “fmt”
func main() {
fmt.Println(squareMinusNum(square, 8))
}
func square (int num) int {
return num*num
}
func squareMinusNum (f(int num) int, num int) int{
x:= f(num)-num
return x
}
Hey Sajir!
You just had a couple of easy fixes. In go the type comes after the name, for example func(num int) instead of func(int num), which is what you had.
https://play.golang.org/p/XexKFyWeL6l
Let me know if you have any more questions about this.