Function call by name in Golang

The golang’s function is a code block like C’s, but it can also be assigned to a variable as its other types.

If you are not familiar with the function, Codewalk: First-Class Functions in Go should be a good starting point for you. Already known it? Let’s go on.

First of all, look at this PHP codes:

function foobar() {
    echo "Hello Golang\n";
$funcs = array(
    "foobar" => "foobar",
    "hello"  => "foobar",

It will print:

[email protected]:~/Desktop$ php foobar.php 
Hello Golang
Hello Golang

Continue reading Function call by name in Golang