callback example
Passing a function (as an argument) to a function. Not really used that often.
GitHub Webpage
CALLBACK
Callback simply means call back the function
you passed in. Calling back home.
In this example, you will be
passing the following anonymous functions to
the sum() function,
// Giving an int, determine if even
anonFunc1 := func(n int) bool {
if n%2 == 0 {
return true
}
return false
}
// Giving an int, determine if odd
anonFunc2 := func(n int) bool {
if n%2 != 0 {
return true
}
return false
}
It just tests if the number is even or odd.
RUN
go run callback.go