callback

command
v0.0.0-...-a2a1f02 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 1 Imported by: 0

README

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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL