去操场#23返回问题

http://tour.golang.org/#23

package main

import (
    "fmt"
    "math"
)

func pow(x, n, lim float64) float64 {
    if v := math.Pow(x, n); v < lim {
        return v

    } else {
        fmt.Printf("%g >= %g
", v, lim)
    }
    // can't use v here, though
    return lim
}

func main() {
    fmt.Println(
        pow(3, 2, 10),
        pow(3, 3, 20),
    )
}

why the output is

27 >= 20
9 20

but not

9
27 >= 20 20

the code for your expected result is

    func main(){
        fmt.Println(pow(3, 2, 10))
        fmt.Println(pow(3, 3, 20))
    }

After all "pow" functions in "fmt.Println" are called, "fmt.Println" prints the results of pows

Because both calls to pow(..) are evaluated before fmt.Println() as they are used as arguments to it.

What you expected would have been the output of

func main() {
    fmt.Println(pow(3, 2, 10))
    fmt.Println(pow(3, 3, 20))
}